Class Aggregate.AggCallBinding

java.lang.Object
org.apache.calcite.sql.SqlOperatorBinding
org.apache.calcite.rel.core.Aggregate.AggCallBinding
Direct Known Subclasses:
Aggregate.PercentileDiscAggCallBinding
Enclosing class:
Aggregate

public static class Aggregate.AggCallBinding extends SqlOperatorBinding
Implementation of the SqlOperatorBinding interface for an aggregate call applied to a set of operands in the context of a LogicalAggregate.
  • Constructor Details

    • AggCallBinding

      public AggCallBinding(RelDataTypeFactory typeFactory, SqlAggFunction aggFunction, List<RelDataType> preOperands, List<RelDataType> operands, int groupCount, boolean filter)
      Creates an AggCallBinding.
      Parameters:
      typeFactory - Type factory
      aggFunction - Aggregate function
      preOperands - Data types of pre-operands
      operands - Data types of operands
      groupCount - Number of columns in the GROUP BY clause
      filter - Whether the aggregate function has a FILTER clause
    • AggCallBinding

      @Deprecated public AggCallBinding(RelDataTypeFactory typeFactory, SqlAggFunction aggFunction, List<RelDataType> operands, int groupCount, boolean filter)
      Deprecated.
  • Method Details

    • getGroupCount

      public int getGroupCount()
      Description copied from class: SqlOperatorBinding
      If the operator call occurs in an aggregate query, returns the number of columns in the GROUP BY clause. For example, for "SELECT count(*) FROM emp GROUP BY deptno, gender", returns 2.

      Returns 0 if the query is implicitly "GROUP BY ()" because of an aggregate expression. For example, "SELECT sum(sal) FROM emp".

      Returns -1 if the query is not an aggregate query.

      Overrides:
      getGroupCount in class SqlOperatorBinding
    • hasFilter

      public boolean hasFilter()
      Description copied from class: SqlOperatorBinding
      Returns whether the operator is an aggregate function with a filter.
      Overrides:
      hasFilter in class SqlOperatorBinding
    • getPreOperandCount

      public int getPreOperandCount()
      Description copied from class: SqlOperatorBinding
      Returns the number of pre-operands. Zero except for a few aggregate functions.
      Overrides:
      getPreOperandCount in class SqlOperatorBinding
    • getOperandCount

      public int getOperandCount()
      Description copied from class: SqlOperatorBinding
      Returns the number of bound operands. Includes pre-operands and regular operands.
      Specified by:
      getOperandCount in class SqlOperatorBinding
    • getOperandType

      public RelDataType getOperandType(int ordinal)
      Description copied from class: SqlOperatorBinding
      Gets the type of a bound operand.
      Specified by:
      getOperandType in class SqlOperatorBinding
      Parameters:
      ordinal - zero-based ordinal of operand of interest
      Returns:
      bound operand type
    • newError

      public CalciteException newError(org.apache.calcite.runtime.Resources.ExInst<SqlValidatorException> e)
      Description copied from class: SqlOperatorBinding
      Wraps a validation error with context appropriate to this operator call.
      Specified by:
      newError in class SqlOperatorBinding
      Parameters:
      e - Validation error, not null
      Returns:
      Error wrapped, if possible, with positional information