Aggregation Functions

This page covers the aggregation functions available in Upsolver.

Aggregations are functions for grouping multiple events together to form a more significant result.

Unlike databases, Upsolver runs continuous queries rather than ad-hoc queries. With Upsolver aggregation results are updated incrementally with every incoming event.

Aggregation functions require windowing to split a stream into buckets of data that can be aggregated.

APPROXIMATE_COUNT_DISTINCT: The approximate number of distinct values in the time window.

APPROX_COUNT_DISTINCT_EACH: The approximate count of distinct values per group in the time window.

AVG: The average value in the time window.

AVG_EACH: The average value in the time window grouped by the given key.

AVG_TIME_SERIES: The average of the values per time interval.

COLLECT_SET: A set of all values encountered in the time interval.

COLLECT_SET_EACH: A set of all values encountered in the time interval grouped by the given key.

COUNT: The number of values in the time window.

COUNT(*): The number of items in the time window.

COUNT_DISTINCT: Counts the number of distinct values that appeared in the column per key value.

COUNT_EACH: The number of items grouped by the given key.

COUNT_IF: The number of true values in the time window.

DECAYED_SUM: Performs a sum on the value and decays that sum based on the decay factor and how old the original data is.

DYNAMIC_SESSIONS: Gets the current sessions, where a session is defined as events separated by no more than windowSize time. If two window sizes are passed, the larger one is used.

FIRST: The first value in the time window.

FIRST_ARRAY: The first array of values in the time window.

FIRST_EACH: The first value per group.

FIRST_TIME_SERIES: The first value per time interval.

LAST: The last value in the time window.

LAST_ARRAY: The last array of values in the time window.

LAST_EACH: The last value per group.

LAST_K: The last k values.

LAST_K_EACH: The last k values per group.

LAST_TIME_SERIES: The last value per interval.

MAX: The maximum value in the time window.

MAX_BY: The value correlating to the maximum sort in the time window.

MAX_EACH: The maximum value per group.

MAX_TIME_SERIES: The maximum value per time interval.

MIN: The minimum value in the time window.

MIN_BY: The value correlating to the minimum sort in the time window.

MIN_EACH: The minimum value per group.

MIN_TIME_SERIES: The minimum value per time interval.

SESSION_COUNT: Stores the number of sessions.

STD_DEV: The standard deviation of values in the time window.

STD_DEV_EACH: The standard deviation of the value per group.

STRING_MAX_EACH: Stores the maximum string value per group, sorted case-sensitive lexicographically.

STRING_MIN_EACH: Stores the minimum string value per group, sorted case-sensitive lexicographically.

SUM: The sum of the values in the time window.

SUM_EACH: The sum of the values per group.

SUM_TIME_SERIES: The sum of the values per time interval.

WEIGHTED_AVERAGE: The weighted average of a value in the time window.

Last updated