Module com.darkcollective.relix.ast
Package com.darkcollective.relix.ast
Enum Class AggregateOperator
- All Implemented Interfaces:
Serializable,Comparable<AggregateOperator>,Constable
Aggregate function operators used in
AggregateFunction.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionReturns a companion column's value from the row that maximises the ranking column — the "argmax" reduction.The minimising counterpart ofARGMAX—ARGMIN(rank, yield)yields theyieldcolumn value from the row whoserankcolumn is smallest.Average (mean) of values in a group.Whether every value in a group is true: SQL'sBOOL_AND, and its standard nameEVERY.Whether any value in a group is true: SQL'sBOOL_OR.Gathers every value in a group into an array, in row order (the NEST /array_agg/ Mongo$pushoperation).Count of rows (or non-null values) in a group.SQL'sGROUPING(k, …): which of the named grouping keys a row has rolled up.Maximum value in a group.The median: the continuous percentile at one half.Minimum value in a group.The most frequent value in a group: PostgreSQL'sMODE() WITHIN GROUP (ORDER BY x)and Oracle'sSTATS_MODE(x).The continuous percentile: the value at a fraction of the way through the sorted values, interpolated.The discrete percentile: the first sorted value whose place reaches a fraction.Sample standard deviation, as SQL'sSTDDEV; NULL for fewer than two values.Population standard deviation.Sample standard deviation.A group's values joined into one string, with a separator — itssecond argument— and an optional ordering.Sum of values in a group.Population variance.Sample variance.Sample variance, as SQL'sVARIANCE; NULL for fewer than two values. -
Method Summary
Modifier and TypeMethodDescriptionstatic AggregateOperatorReturns the enum constant of this class with the specified name.static AggregateOperator[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SUM
Sum of values in a group. -
AVG
Average (mean) of values in a group. -
COUNT
Count of rows (or non-null values) in a group. -
MIN
Minimum value in a group. -
MAX
Maximum value in a group. -
COLLECT
Gathers every value in a group into an array, in row order (the NEST /array_agg/ Mongo$pushoperation). Unlike the scalar reducers above,COLLECTproduces a nested array-valued output column — the inverse ofUNNEST. It is how a query produces nested output. -
ARGMAX
Returns a companion column's value from the row that maximises the ranking column — the "argmax" reduction. WrittenARGMAX(rank, yield): within each group it finds the row whoserankcolumn is largest and yields that row'syieldcolumn value (theyield expression).This is the row-with-the-maximum / "groupwise maximum" operation that SQL expresses only awkwardly (a window function plus a filter, or a self-join back to a
MAXsubquery). Ties resolve to the first such row in input order; rows with a null rank are ignored; an empty group yields null. LikeCOLLECTit has no portable SQL spelling, so it is never pushed down. -
ARGMIN
The minimising counterpart ofARGMAX—ARGMIN(rank, yield)yields theyieldcolumn value from the row whoserankcolumn is smallest. -
STDDEV
Sample standard deviation, as SQL'sSTDDEV; NULL for fewer than two values. -
STDDEV_SAMP
Sample standard deviation. -
STDDEV_POP
Population standard deviation. -
VARIANCE
Sample variance, as SQL'sVARIANCE; NULL for fewer than two values. -
VAR_SAMP
Sample variance. -
VAR_POP
Population variance. -
PERCENTILE_CONT
The continuous percentile: the value at a fraction of the way through the sorted values, interpolated. Itssecond argumentis the fraction. -
PERCENTILE_DISC
The discrete percentile: the first sorted value whose place reaches a fraction. Itssecond argumentis the fraction. -
MEDIAN
The median: the continuous percentile at one half. -
STRING_AGG
A group's values joined into one string, with a separator — itssecond argument— and an optional ordering. SQL'sSTRING_AGG,GROUP_CONCATandLISTAGG. -
BOOL_AND
Whether every value in a group is true: SQL'sBOOL_AND, and its standard nameEVERY. NULLs are skipped, and a group with no value is NULL. -
BOOL_OR
Whether any value in a group is true: SQL'sBOOL_OR. NULLs are skipped, and a group with no value is NULL. -
MODE
The most frequent value in a group: PostgreSQL'sMODE() WITHIN GROUP (ORDER BY x)and Oracle'sSTATS_MODE(x). A tie goes to the first of the equally frequent values in the aggregate'sordering, which is the value itself, ascending, when it has none: the smallest. -
GROUPING
SQL'sGROUPING(k, …): which of the named grouping keys a row has rolled up. A key a row's grouping set leaves out is NULL in that row, as a NULL in the data may be too, and this is how the two are told apart. Each named key is one bit, the last the lowest, set when the key is rolled up, soGROUPING(region)is 1 in a subtotal over every region and 0 elsewhere. Itsargumentis anArrayConstructionof the keys. It reads no rows: the engine computes it from the grouping set, and it is not in a function library.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-