Skip to main content

Aggregate

Function NameDescription
APPROX_COUNT_DISTINCTReturns the approximate number of unique, non-null values in a column.
ARRAY_AGGAggregates the provided expression into an array.
ARRAY_AVGReturns the average of all non-null elements of a list.
ARRAY_MAXReturns the maximum value of a list.
ARRAY_MINReturns the minimum value of a list.
ARRAY_SUMReturns the sum of all non-null elements of a list.
AVGComputes the average of a set of values.
BIT_ANDReturns the bitwise AND of non-NULL input values.
BIT_ORReturns the bitwise OR of non-NULL input values.
CORRCalculates the Pearson correlation coefficient of the values expression1 and expression2.
COUNTReturns the total number of records for the specified expression.
COVAR_POPReturns the population covariance for non-NULL pairs across all input values.
COVAR_SAMPReturns the sample covariance for non-NULL pairs across all input values.
LISTAGGConcatenates a group of rows into a list of strings and places a separator between them.
MAXReturns the maximum value among the non-NULL input expressions.
MEDIANComputes the median of the specified column's values based on a continuous distribution.
MINReturns the minimum value among the non-NULL input expressions.
NDVReturns an approximate distinct value number, similar to COUNT(DISTINCT col). NDV can return results faster than using the combination of COUNT and DISTINCT while using a constant amount of memory, resulting in less memory usage for columns with high cardinality.
STDDEVReturns the standard deviation of non-NULL values in a column with a numeric data type. If all records inside a group are NULL, returns NULL.
STDDEV_POPReturns the population standard deviation (square root of variance) of non-NULL values in a column with a numeric data type. If all records inside a group are NULL, returns NULL.
STDDEV_SAMPReturns the sample standard deviation (square root of sample variance) of non-NULL values in a column with a numeric data type. If all records inside a group are NULL, returns NULL.
SUMReturns the sum of non-NULL input expressions.
VAR_POPReturns the population variance of non-NULL records.
VAR_SAMPReturns the sample variance of non-NULL records.