Aggregation function types at a glance

An aggregation function performs a calculation on a set of values, and returns a single value. These functions are used in conjunction with the summarize operator. This article lists all available aggregation functions grouped by type. For scalar functions, see Scalar function types.

Binary functions

Function Name Description
binary_all_and() Returns aggregated value using the binary AND of the group.
binary_all_or() Returns aggregated value using the binary OR of the group.
binary_all_xor() Returns aggregated value using the binary XOR of the group.

Dynamic functions

Function Name Description
buildschema() Returns the minimal schema that admits all values of the dynamic input.
make_bag(), make_bag_if() Returns a property bag of dynamic values within the group without/with a predicate.
make_list(), make_list_if() Returns a list of all the values within the group without/with a predicate.
make_list_with_nulls() Returns a list of all the values within the group, including null values.
make_set(), make_set_if() Returns a set of distinct values within the group without/with a predicate.

Row selector functions

Function Name Description
arg_max() Returns one or more expressions when the argument is maximized.
arg_min() Returns one or more expressions when the argument is minimized.
take_any(), take_anyif() Returns a random non-empty value for the group without/with a predicate.

Statistical functions

Function Name Description
avg() Returns an average value across the group.
avgif() Returns an average value across the group (with predicate).
count(), countif() Returns a count of the group without/with a predicate.
count_distinct(), count_distinctif() Returns a count of unique elements in the group without/with a predicate.
dcount(), dcountif() Returns an approximate distinct count of the group elements without/with a predicate.
hll() Returns the HyperLogLog (HLL) results of the group elements, an intermediate value of the dcount approximation.
hll_if() Returns the HyperLogLog (HLL) results of the group elements, an intermediate value of the dcount approximation (with predicate).
hll_merge() Returns a value for merged HLL results.
max(), maxif() Returns the maximum value across the group without/with a predicate.
min(), minif() Returns the minimum value across the group without/with a predicate.
percentile() Returns a percentile estimation of the group.
percentiles() Returns percentile estimations of the group.
percentiles_array() Returns the percentile approximates of the array.
percentilesw() Returns the weighted percentile approximate of the group.
percentilesw_array() Returns the weighted percentile approximate of the array.
stdev(), stdevif() Returns the standard deviation across the group for a population that is considered a sample without/with a predicate.
stdevp() Returns the standard deviation across the group for a population that is considered representative.
sum(), sumif() Returns the sum of the elements within the group without/with a predicate.
tdigest() Returns an intermediate result for the percentiles approximation, the weighted percentile approximate of the group.
tdigest_merge() Returns the merged tdigest value across the group.
variance(), varianceif() Returns the variance across the group without/with a predicate.
variancep() Returns the variance across the group for a population that is considered representative.