Hive Aggregate Functions 1


Creating Table in HIVE :

Aggregated Functions and Normal Queries:

SUM

Returns the sum of the elements in the group or sum of the distinct values of the column in the group.

Count

count(*) – Returns the total number of retrieved rows, including rows containing NULL values;

count(expr) – Returns the number of rows for which the supplied expression is non-NULL;

count(DISTINCT expr[, expr]) – Returns the number of rows for which the supplied expression(s) are unique and non- NULL;

Average

Returns the average of the elements in the group or the average of the distinct values of the column in the group.

Minimum

Returns the minimum of the column in the group.

Maximum

Returns the maximum of the column in the group.

Variance

Returns the variance of a numeric column in the group.