Class AggregateCall


  • public class AggregateCall
    extends java.lang.Object
    Call to an aggregate function within an Aggregate.
    • Field Detail

      • distinct

        private final boolean distinct
      • approximate

        private final boolean approximate
      • name

        public final java.lang.String name
      • argList

        private final com.google.common.collect.ImmutableList<java.lang.Integer> argList
      • filterArg

        public final int filterArg
    • Constructor Detail

      • AggregateCall

        @Deprecated
        public AggregateCall​(SqlAggFunction aggFunction,
                             boolean distinct,
                             java.util.List<java.lang.Integer> argList,
                             RelDataType type,
                             java.lang.String name)
        Deprecated.
        Creates an AggregateCall.
        Parameters:
        aggFunction - Aggregate function
        distinct - Whether distinct
        argList - List of ordinals of arguments
        type - Result type
        name - Name (may be null)
      • AggregateCall

        private AggregateCall​(SqlAggFunction aggFunction,
                              boolean distinct,
                              boolean approximate,
                              java.util.List<java.lang.Integer> argList,
                              int filterArg,
                              RelCollation collation,
                              RelDataType type,
                              java.lang.String name)
        Creates an AggregateCall.
        Parameters:
        aggFunction - Aggregate function
        distinct - Whether distinct
        approximate - Whether approximate
        argList - List of ordinals of arguments
        filterArg - Ordinal of filter argument (the FILTER (WHERE ...) clause in SQL), or -1
        collation - How to sort values before aggregation (the WITHIN GROUP clause in SQL)
        type - Result type
        name - Name (may be null)
    • Method Detail

      • create

        @Deprecated
        public static AggregateCall create​(SqlAggFunction aggFunction,
                                           boolean distinct,
                                           java.util.List<java.lang.Integer> argList,
                                           int groupCount,
                                           RelNode input,
                                           RelDataType type,
                                           java.lang.String name)
        Deprecated.
      • create

        @Deprecated
        public static AggregateCall create​(SqlAggFunction aggFunction,
                                           boolean distinct,
                                           java.util.List<java.lang.Integer> argList,
                                           int filterArg,
                                           int groupCount,
                                           RelNode input,
                                           RelDataType type,
                                           java.lang.String name)
        Deprecated.
      • create

        @Deprecated
        public static AggregateCall create​(SqlAggFunction aggFunction,
                                           boolean distinct,
                                           boolean approximate,
                                           java.util.List<java.lang.Integer> argList,
                                           int filterArg,
                                           int groupCount,
                                           RelNode input,
                                           RelDataType type,
                                           java.lang.String name)
        Deprecated.
      • create

        public static AggregateCall create​(SqlAggFunction aggFunction,
                                           boolean distinct,
                                           boolean approximate,
                                           java.util.List<java.lang.Integer> argList,
                                           int filterArg,
                                           RelCollation collation,
                                           int groupCount,
                                           RelNode input,
                                           RelDataType type,
                                           java.lang.String name)
        Creates an AggregateCall, inferring its type if type is null.
      • create

        @Deprecated
        public static AggregateCall create​(SqlAggFunction aggFunction,
                                           boolean distinct,
                                           java.util.List<java.lang.Integer> argList,
                                           int filterArg,
                                           RelDataType type,
                                           java.lang.String name)
        Deprecated.
      • create

        @Deprecated
        public static AggregateCall create​(SqlAggFunction aggFunction,
                                           boolean distinct,
                                           boolean approximate,
                                           java.util.List<java.lang.Integer> argList,
                                           int filterArg,
                                           RelDataType type,
                                           java.lang.String name)
        Deprecated.
      • create

        public static AggregateCall create​(SqlAggFunction aggFunction,
                                           boolean distinct,
                                           boolean approximate,
                                           java.util.List<java.lang.Integer> argList,
                                           int filterArg,
                                           RelCollation collation,
                                           RelDataType type,
                                           java.lang.String name)
        Creates an AggregateCall.
      • isDistinct

        public final boolean isDistinct()
        Returns whether this AggregateCall is distinct, as in COUNT(DISTINCT empno).
        Returns:
        whether distinct
      • isApproximate

        public final boolean isApproximate()
        Returns whether this AggregateCall is approximate, as in APPROX_COUNT_DISTINCT(empno).
        Returns:
        whether approximate
      • getAggregation

        public final SqlAggFunction getAggregation()
        Returns the aggregate function.
        Returns:
        aggregate function
      • getCollation

        public RelCollation getCollation()
        Returns the aggregate ordering definition (the WITHIN GROUP clause in SQL), or the empty list if not specified.
        Returns:
        ordering definition
      • getArgList

        public final java.util.List<java.lang.Integer> getArgList()
        Returns the ordinals of the arguments to this call.

        The list is immutable.

        Returns:
        list of argument ordinals
      • getType

        public final RelDataType getType()
        Returns the result type.
        Returns:
        result type
      • getName

        public java.lang.String getName()
        Returns the name.
        Returns:
        name
      • rename

        public AggregateCall rename​(java.lang.String name)
        Creates an equivalent AggregateCall that has a new name.
        Parameters:
        name - New name (may be null)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hasFilter

        public boolean hasFilter()
        Returns true if and only if this AggregateCall has a filter argument
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • copy

        public AggregateCall copy​(java.util.List<java.lang.Integer> args,
                                  int filterArg,
                                  RelCollation collation)
        Creates an equivalent AggregateCall with new argument ordinals.
        Parameters:
        args - Arguments
        Returns:
        AggregateCall that suits new inputs and GROUP BY columns
        See Also:
        transform(Mappings.TargetMapping)
      • copy

        @Deprecated
        public AggregateCall copy​(java.util.List<java.lang.Integer> args,
                                  int filterArg)
        Deprecated.
      • copy

        @Deprecated
        public AggregateCall copy​(java.util.List<java.lang.Integer> args)
        Deprecated.
      • adaptTo

        public AggregateCall adaptTo​(RelNode input,
                                     java.util.List<java.lang.Integer> argList,
                                     int filterArg,
                                     int oldGroupKeyCount,
                                     int newGroupKeyCount)
        Creates equivalent AggregateCall that is adapted to a new input types and/or number of columns in GROUP BY.
        Parameters:
        input - relation that will be used as a child of aggregate
        argList - argument indices of the new call in the input
        filterArg - Index of the filter, or -1
        oldGroupKeyCount - number of columns in GROUP BY of old aggregate
        newGroupKeyCount - number of columns in GROUP BY of new aggregate
        Returns:
        AggregateCall that suits new inputs and GROUP BY columns