[feature] Support pre-aggregation for quantile type (#8234)

Add a new column-type to speed up the approximation of quantiles.
1. The  new column-type is named `quantile_state` with fixed aggregation function `quantile_union`, which stores the intermediate results of pre-aggregated approximation calculations for quantiles.
2. support pre-aggregation of new column-type and quantile_state related functions.
This commit is contained in:
spaces-x
2022-03-24 09:11:34 +08:00
committed by GitHub
parent 36c85d2f06
commit bea9a7ba4f
67 changed files with 1498 additions and 153 deletions

View File

@ -246,6 +246,7 @@ void* ExprContext::get_value(Expr* e, TupleRow* row) {
case TYPE_VARCHAR:
case TYPE_HLL:
case TYPE_OBJECT:
case TYPE_QUANTILE_STATE:
case TYPE_STRING: {
doris_udf::StringVal v = e->get_string_val(this, row);
if (v.is_null) {
@ -375,7 +376,7 @@ Status ExprContext::get_const_value(RuntimeState* state, Expr& expr, AnyVal** co
char* ptr_copy = reinterpret_cast<char*>(_pool->try_allocate(sv->len, &rst));
if (ptr_copy == nullptr) {
RETURN_LIMIT_EXCEEDED(_pool->mem_tracker(), state,
"Could not allocate constant string value", sv->len, rst);
"Could not allocate constant string value", sv->len, rst);
}
memcpy(ptr_copy, sv->ptr, sv->len);
sv->ptr = reinterpret_cast<uint8_t*>(ptr_copy);