Enum Class AggregateOperator

java.lang.Object
java.lang.Enum<AggregateOperator>
com.darkcollective.relix.ast.AggregateOperator
All Implemented Interfaces:
Serializable, Comparable<AggregateOperator>, Constable

public enum AggregateOperator extends Enum<AggregateOperator>
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 Constants
    Enum Constant
    Description
    Returns a companion column's value from the row that maximises the ranking column — the "argmax" reduction.
    The minimising counterpart of ARGMAX — ARGMIN(rank, yield) yields the yield column value from the row whose rank column is smallest.
    Average (mean) of values in a group.
    Whether every value in a group is true: SQL's BOOL_AND, and its standard name EVERY.
    Whether any value in a group is true: SQL's BOOL_OR.
    Gathers every value in a group into an array, in row order (the NEST / array_agg / Mongo $push operation).
    Count of rows (or non-null values) in a group.
    SQL's GROUPING(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's MODE() WITHIN GROUP (ORDER BY x) and Oracle's STATS_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's STDDEV; NULL for fewer than two values.
    Population standard deviation.
    Sample standard deviation.
    A group's values joined into one string, with a separator — its second argument — and an optional ordering.
    Sum of values in a group.
    Population variance.
    Sample variance.
    Sample variance, as SQL's VARIANCE; NULL for fewer than two values.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • SUM

      public static final AggregateOperator SUM
      Sum of values in a group.
    • AVG

      public static final AggregateOperator AVG
      Average (mean) of values in a group.
    • COUNT

      public static final AggregateOperator COUNT
      Count of rows (or non-null values) in a group.
    • MIN

      public static final AggregateOperator MIN
      Minimum value in a group.
    • MAX

      public static final AggregateOperator MAX
      Maximum value in a group.
    • COLLECT

      public static final AggregateOperator COLLECT
      Gathers every value in a group into an array, in row order (the NEST / array_agg / Mongo $push operation). Unlike the scalar reducers above, COLLECT produces a nested array-valued output column — the inverse of UNNEST. It is how a query produces nested output.
    • ARGMAX

      public static final AggregateOperator ARGMAX
      Returns a companion column's value from the row that maximises the ranking column — the "argmax" reduction. Written ARGMAX(rank, yield): within each group it finds the row whose rank column is largest and yields that row's yield column value (the yield 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 MAX subquery). Ties resolve to the first such row in input order; rows with a null rank are ignored; an empty group yields null. Like COLLECT it has no portable SQL spelling, so it is never pushed down.

    • ARGMIN

      public static final AggregateOperator ARGMIN
      The minimising counterpart of ARGMAX — ARGMIN(rank, yield) yields the yield column value from the row whose rank column is smallest.
    • STDDEV

      public static final AggregateOperator STDDEV
      Sample standard deviation, as SQL's STDDEV; NULL for fewer than two values.
    • STDDEV_SAMP

      public static final AggregateOperator STDDEV_SAMP
      Sample standard deviation.
    • STDDEV_POP

      public static final AggregateOperator STDDEV_POP
      Population standard deviation.
    • VARIANCE

      public static final AggregateOperator VARIANCE
      Sample variance, as SQL's VARIANCE; NULL for fewer than two values.
    • VAR_SAMP

      public static final AggregateOperator VAR_SAMP
      Sample variance.
    • VAR_POP

      public static final AggregateOperator VAR_POP
      Population variance.
    • PERCENTILE_CONT

      public static final AggregateOperator PERCENTILE_CONT
      The continuous percentile: the value at a fraction of the way through the sorted values, interpolated. Its second argument is the fraction.
    • PERCENTILE_DISC

      public static final AggregateOperator PERCENTILE_DISC
      The discrete percentile: the first sorted value whose place reaches a fraction. Its second argument is the fraction.
    • MEDIAN

      public static final AggregateOperator MEDIAN
      The median: the continuous percentile at one half.
    • STRING_AGG

      public static final AggregateOperator STRING_AGG
      A group's values joined into one string, with a separator — its second argument — and an optional ordering. SQL's STRING_AGG, GROUP_CONCAT and LISTAGG.
    • BOOL_AND

      public static final AggregateOperator BOOL_AND
      Whether every value in a group is true: SQL's BOOL_AND, and its standard name EVERY. NULLs are skipped, and a group with no value is NULL.
    • BOOL_OR

      public static final AggregateOperator BOOL_OR
      Whether any value in a group is true: SQL's BOOL_OR. NULLs are skipped, and a group with no value is NULL.
    • MODE

      public static final AggregateOperator MODE
      The most frequent value in a group: PostgreSQL's MODE() WITHIN GROUP (ORDER BY x) and Oracle's STATS_MODE(x). A tie goes to the first of the equally frequent values in the aggregate's ordering, which is the value itself, ascending, when it has none: the smallest.
    • GROUPING

      public static final AggregateOperator GROUPING
      SQL's GROUPING(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, so GROUPING(region) is 1 in a subtotal over every region and 0 elsewhere. Its argument is an ArrayConstruction of 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

      public static AggregateOperator[] 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

      public static AggregateOperator valueOf(String name)
      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 name
      NullPointerException - if the argument is null