You need to enable JavaScript to run this app.
ByteHouse Enterprise Edition

ByteHouse Enterprise Edition

Copy page
Download PDF
Aggregate function
initializeAggregation
Copy page
Download PDF
initializeAggregation

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_functionAggregate 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 │ 
└──────────────────┘
Last updated: 2026.03.31 11:49:59