Class SqlMinMaxAggFunction

  • All Implemented Interfaces:
    Context, Wrapper

    public class SqlMinMaxAggFunction
    extends SqlAggFunction
    Definition of the MIN and MAX aggregate functions, returning the returns the smallest/largest of the values which go into it.

    There are 3 forms:

    sum(primitive type)
    values are compared using '<'
    values are compared using Comparable.compareTo(T)
    sum(Comparator, Object)
    the, T) method of the comparator is used to compare pairs of objects. The comparator is a startup argument, and must therefore be constant for the duration of the aggregation.
    • Constructor Detail

      • SqlMinMaxAggFunction

        public SqlMinMaxAggFunction​(SqlKind kind)
        Creates a SqlMinMaxAggFunction.
      • SqlMinMaxAggFunction

        public SqlMinMaxAggFunction​(java.util.List<RelDataType> argTypes,
                                    boolean isMin,
                                    int minMaxKind)
    • Method Detail

      • isMin

        public boolean isMin()
      • getMinMaxKind

        public int getMinMaxKind()
      • getDistinctOptionality

        public Optionality getDistinctOptionality()
        Description copied from class: SqlAggFunction
        Returns whether this aggregate function allows the DISTINCT keyword.

        The default implementation returns Optionality.OPTIONAL, which is appropriate for most aggregate functions, including SUM and COUNT.

        Some aggregate functions, for example MIN, produce the same result with or without DISTINCT, and therefore return Optionality.IGNORED to indicate this. For such functions, Calcite will probably remove DISTINCT while optimizing the query.

        getDistinctOptionality in class SqlAggFunction
      • unwrap

        public <T> T unwrap​(java.lang.Class<T> clazz)
        Description copied from interface: Wrapper
        Finds an instance of an interface implemented by this object, or returns null if this object does not support that interface.
        Specified by:
        unwrap in interface Wrapper
        unwrap in class SqlAggFunction