v.18.12New Feature
Enhancements to Aggregate Functions: Merging and Scaling States
Now you can add (merge) states of aggregate functions by using the plus operator, and multiply the states of aggregate functions by a nonnegative constant. #3062 #3034
Why it matters
This feature allows users to combine the intermediate states of aggregate functions more flexibly by enabling addition and scaling of these states. It improves the capability to perform complex aggregate state manipulations, facilitating custom aggregation logic and optimization of distributed query processing.How to use it
Users can merge aggregate function states by applying the+ operator between them, and multiply an aggregate function state by a nonnegative constant using the multiplication operator. This enables expressions like agg_state_1 + agg_state_2 and agg_state * constant within SQL queries or aggregate function manipulations.