initializeAggregation
Initializes aggregation for your input rows. It is intended for the functions with the suffix State
.
Use it for tests or to process columns of types AggregateFunction
and AggregationgMergeTree
.
Syntax
initializeAggregation (aggregate_function, column_1, column_2);
Arguments
aggregate_function
— Name of the aggregation function. The state of this function — the creating one. String.column_n
— The column to translate it into the function as it’s argument. String.
Returned value(s)
Returns the result of the aggregation for your input rows. The return type will be the same as the return type of function, that initializeAgregation
takes as first argument.
For example for functions with the suffix State
the return type will be AggregateFunction
.
Example
Query:
SELECT uniqMerge(state) FROM (SELECT initializeAggregation('uniqState', number % 3) AS state FROM system.numbers LIMIT 10000);
Result:
┌─uniqMerge(state)─┐
│ 3 │
└──────────────────┘
当前内容版权归 ClickHouse 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 ClickHouse .