Aggregation functions

EQL supports the following aggregation functions.

Function Description
AVG Computes the arithmetic mean value for a field.
COUNT Counts the number of records with valid non-NULL values in a field for each GROUP BY result.
COUNTDISTINCT Counts the number of unique, valid non-NULL values in a field for each GROUP BY result.
MAX Finds the maximum value for a field.
MIN Finds the minimum value for a field.
MEDIAN Finds the median value for a field.
Note that the EQL definition of MEDIAN differs from the normal statistical definition when EQL is computing the median of an even number of numbers. That is, given an input relation containing {1,2,3,4}, the following query:
RETURN results AS SELECT
  MEDIAN(a) AS med
GROUP
produces the relation { <med:3> }. According to the normal statistical definition, the statistical median of the set {1, 2, 3, 4} should be the mean of the two elements in the middle of the sorted set, or 2.5.
STDDEV Computes the standard deviation for a field.
ARB Selects an arbitrary but consistent value from the set of values in a field.
SUM Computes the sum of field values.
VARIANCE Computes the variance (that is, the square of the standard deviation) for a field.