Enum Class ReducerFunction

java.lang.Object
java.lang.Enum<ReducerFunction>
com.redis.vl.query.ReducerFunction
All Implemented Interfaces:
Serializable, Comparable<ReducerFunction>, Constable

public enum ReducerFunction extends Enum<ReducerFunction>
Enumeration of available reducer functions for Redis aggregation operations.

Ported from Redis OM Spring ReducerFunction.java

These functions correspond to the reducer functions available in RediSearch aggregation queries. Each function performs a specific type of calculation or transformation on grouped data during aggregation operations.

Reducer functions are categorized into:

  • Counting functions: COUNT, COUNT_DISTINCT, COUNT_DISTINCTISH
  • Mathematical functions: SUM, MIN, MAX, AVG, STDDEV
  • Statistical functions: QUANTILE, RANDOM_SAMPLE
  • Collection functions: TOLIST, FIRST_VALUE
Since:
0.1.0
  • 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
    REDUCE AVG 1 {property} - Return the average value of a numeric property.
    REDUCE COUNT 0 - Count the number of records in each group
    REDUCE COUNT_DISTINCT 1 {property} - Count the number of distinct values for property.
    REDUCE COUNT_DISTINCTISH 1 {property} - Same as COUNT_DISTINCT but provides an approximation instead of an exact count
    REDUCE FIRST_VALUE {nargs} {property} [BY {property} [ASC|DESC]] - Return the first or top value of a given property in the group, optionally by comparing that or another property
    REDUCE MAX 1 {property} - Return the maximal value of a property, whether it is a string, number or NULL.
    REDUCE MIN 1 {property} - Return the minimal value of a property, whether it is a string, number or NULL.
    REDUCE QUANTILE 2 {property} {quantile} - Return the value of a numeric property at a given quantile of the results.
    REDUCE RANDOM_SAMPLE {nargs} {property} {sample_size} - Perform a reservoir sampling of the group elements with a given size, and return an array of the sampled items with an even distribution.
    REDUCE STDDEV 1 {property} - Return the standard deviation of a numeric property in the group.
    REDUCE SUM 1 {property} - Return the sum of all numeric values of a given property in a group.
    REDUCE TOLIST 1 {property} - Merge all distinct values of a given property into a single array.
  • 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

    • COUNT

      public static final ReducerFunction COUNT
      REDUCE COUNT 0 - Count the number of records in each group
    • COUNT_DISTINCT

      public static final ReducerFunction COUNT_DISTINCT
      REDUCE COUNT_DISTINCT 1 {property} - Count the number of distinct values for property.
    • COUNT_DISTINCTISH

      public static final ReducerFunction COUNT_DISTINCTISH
      REDUCE COUNT_DISTINCTISH 1 {property} - Same as COUNT_DISTINCT but provides an approximation instead of an exact count
    • SUM

      public static final ReducerFunction SUM
      REDUCE SUM 1 {property} - Return the sum of all numeric values of a given property in a group. Non-numeric values if the group are counted as 0.
    • MIN

      public static final ReducerFunction MIN
      REDUCE MIN 1 {property} - Return the minimal value of a property, whether it is a string, number or NULL.
    • MAX

      public static final ReducerFunction MAX
      REDUCE MAX 1 {property} - Return the maximal value of a property, whether it is a string, number or NULL.
    • AVG

      public static final ReducerFunction AVG
      REDUCE AVG 1 {property} - Return the average value of a numeric property.
    • STDDEV

      public static final ReducerFunction STDDEV
      REDUCE STDDEV 1 {property} - Return the standard deviation of a numeric property in the group.
    • QUANTILE

      public static final ReducerFunction QUANTILE
      REDUCE QUANTILE 2 {property} {quantile} - Return the value of a numeric property at a given quantile of the results. Quantile is expressed as a number between 0 and 1.
    • TOLIST

      public static final ReducerFunction TOLIST
      REDUCE TOLIST 1 {property} - Merge all distinct values of a given property into a single array.
    • FIRST_VALUE

      public static final ReducerFunction FIRST_VALUE
      REDUCE FIRST_VALUE {nargs} {property} [BY {property} [ASC|DESC]] - Return the first or top value of a given property in the group, optionally by comparing that or another property
    • RANDOM_SAMPLE

      public static final ReducerFunction RANDOM_SAMPLE
      REDUCE RANDOM_SAMPLE {nargs} {property} {sample_size} - Perform a reservoir sampling of the group elements with a given size, and return an array of the sampled items with an even distribution.
  • Method Details

    • values

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