ByteHouse Enterprise Edition
Initializes the aggregate of your input rows. Used for functions with the suffix State. Use it to test or process columns of AggregateFunction and AggregationgMergeTree type.
Syntax
initializeAggregation (aggregate_function, column_1, column_2)
Params aggregate_function — Aggregate function name. The State of this function — being created. String type.column_n — The column to convert to the function's parameter. String type.
Return value
Backs the aggregate result of the input row. The return type will be the same as the return type of the function that initializeAgregation uses as the first parameter.
For example, for a function with the suffix State, the return type will be AggregateFunction.
Example
Search:
SELECT uniqMerge(state) FROM (SELECT initializeAggregation('uniqState', number % 3) AS state FROM system.numbers LIMIT 10000);
As a result:
┌─uniqMerge(state)─┐ │ 3 │ └──────────────────┘