Skip to content

rollup()

Combine multiple frequency aggregates

Since 1.16.0

Combine multiple aggregates created with freq_agg or mcv_agg functions. Create the source aggregates with the same parameters (same frequency for freq_agg, same count and skew for mcv_agg). The parameters are not checked: the result takes the parameters of one input aggregate, so a mismatch gives order-dependent results.

This produces a very similar aggregate to running the same aggregate function over all the source data. In most cases, any difference is no more than what you might get from simply reordering the input. However, if the source data for the different aggregates is very differently distributed, the rollup result may have looser frequency bounds.

The syntax is:

rollup(
agg SpaceSavingAggregate
) RETURNS SpaceSavingAggregate
NameTypeDefaultRequiredDescription
aggSpaceSavingAggregate-✔The aggregates to roll up. Create these with the same parameters.
ColumnTypeDescription
rollupSpaceSavingAggregateAn aggregate containing the most common elements from all of the underlying data for all of the aggregates.