# Aggregate Functions

Aggregate functions perform a calculation on a set of values and return a single value.

COUNT(expression)
COUNT(*)
1
2

Return the number of rows. When expression is specified, the count returned will be the number of matched rows. When * is specified, the count returned will be the total number of rows.

AVG(expression)
1

Return the average value of a given expression.

SUM(expression)
1

Return the sum value of a given expression.

MAX(expression)
1

Return the max value of a given expression.

MIN(expression)
1

Return the min value of a given expression.

TOPK(expression_value, expression_k)
1

Return the top K(specified by expression_k) values of expression_value in a array.

TOPKDISTINCT(expression_value, expression_k)
1

Similar to TOPK, but only returns distinct values of expression_value.