Skip to main content
ReferenceApplies to: Unified engine deployments
Aggregate functions compute a value for a group. They can also appear as aggregate window functions where supported. Use GROUP BY to define groups and HAVING to filter them.

Group summaries

Statistical aggregates

Sample and population definitions use different denominators. Sample statistics need enough non-null observations; do not replace an undefined statistic with zero without considering the meaning of the result.
The Native translation of sample variance (var_sample and its aliases) currently emits an unavailable function. Population variance is used in the runnable example.

Aggregate modifiers

DISTINCT applies before aggregation. Supported aggregate filters restrict the inputs for one aggregate without changing the other aggregates in the row. Ordered aggregate arguments and explicit NULL treatment have backend restrictions. collect_list and collect_set are unavailable because their required Spark null and empty-input behavior is not implemented. For an empty ungrouped input, COUNT returns zero. SUM, AVG, MIN, and MAX generally return NULL. Grouped empty input produces no group rows.
Last modified on November 4, 2026