EQL supports the following aggregation functions.
Function | Description |
---|---|
ARB | Selects an arbitrary but consistent value from the set of values in a field. Works on both multi-assign attributes (sets) and single-assign attributes. |
AVG | Computes the arithmetic mean value for a field. |
CORRELATION | Computes the correlation coefficient between two numeric fields. |
COUNT | Counts the number of records with valid non-NULL values in a field for each GROUP BY result. Works on both multi-assign attributes (sets) and single-assign attributes. |
COUNT_APPROX | Counts the most frequent refinements. Works on both multi-assign attributes (sets) and single-assign attributes. |
COUNTDISTINCT | Counts the number of unique, valid non-NULL values in a field for each GROUP BY result. Works on both multi-assign attributes (sets) and single-assign attributes. |
APPROXCOUNTDISTINCT | Counts the number of unique, valid non-NULL values in a field for each GROUP BY result. Works on both multi-assign attributes (sets) and single-assign attributes. |
HAS_REFINEMENTS | Determines whether a specific attribute has non-implicit refinements. |
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
PAGE PERCENT provides overlapping
functionality). If the argument is an integer, a double is always returned.
Note that the EQL definition of
MEDIAN is the same as 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 FROM SaleState GROUPproduces the mean of the two elements in the middle of the sorted set, or 2.5. |
PERCENTILE | Computes the percentile for a field. |
RECORD_IN_FAST_SAMPLE | Returns a sample of the records in the named state. |
STDDEV | Computes the standard deviation for a field. |
STRING_JOIN | Creates a single string containing all the values of a string attribute. |
SUM | Computes the sum of field values. |
VARIANCE | Computes the variance (that is, the square of the standard deviation) for a field. |
STRING_JOIN('delimiter', string_attribute)
The delimiter is a string literal enclosed in single quotation marks.
The resulting strings are sorted in a lexicographical order within each group. NULL values are ignored in the output, but values having the empty string are not.
RETURN results AS SELECT STRING_JOIN(', ',R_NAME) AS Regions, STRING_JOIN(',',N_NAME) AS Nations FROM ProductState GROUP
Nations ALGERIA, ARGENTINA, BRAZIL, CANADA, CHINA, EGYPT, ETHIOPIA, FRANCE, GERMANY, INDIA, INDONESIA, IRAN, IRAQ, JAPAN, JORDAN, KENYA, MOROCCO, MOZAMBIQUE, PERU, ROMANIA, RUSSIA, SAUDI ARABIA, UNITED KINGDOM, UNITED STATES, VIETNAM Regions AFRICA,AMERICA,ASIA,EUROPE,MIDDLE EAST