Package org.apache.calcite.rel.core
Class Aggregate.AggCallBinding
- java.lang.Object
-
- org.apache.calcite.sql.SqlOperatorBinding
-
- org.apache.calcite.rel.core.Aggregate.AggCallBinding
-
- Enclosing class:
- Aggregate
public static class Aggregate.AggCallBinding extends SqlOperatorBinding
Implementation of theSqlOperatorBinding
interface for anaggregate call
applied to a set of operands in the context of aLogicalAggregate
.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
filter
private int
groupCount
private java.util.List<RelDataType>
operands
-
Fields inherited from class org.apache.calcite.sql.SqlOperatorBinding
typeFactory
-
-
Constructor Summary
Constructors Constructor Description AggCallBinding(RelDataTypeFactory typeFactory, SqlAggFunction aggFunction, java.util.List<RelDataType> operands, int groupCount, boolean filter)
Creates an AggCallBinding
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getGroupCount()
If the operator call occurs in an aggregate query, returns the number of columns in the GROUP BY clause.int
getOperandCount()
RelDataType
getOperandType(int ordinal)
Gets the type of a bound operand.boolean
hasFilter()
Returns whether the operator is an aggregate function with a filter.CalciteException
newError(Resources.ExInst<SqlValidatorException> e)
Wraps a validation error with context appropriate to this operator call.-
Methods inherited from class org.apache.calcite.sql.SqlOperatorBinding
collectOperandTypes, getColumnListParamInfo, getCursorOperand, getIntLiteralOperand, getOperandLiteralValue, getOperandLiteralValue, getOperandMonotonicity, getOperator, getStringLiteralOperand, getTypeFactory, isOperandLiteral, isOperandNull
-
-
-
-
Field Detail
-
operands
private final java.util.List<RelDataType> operands
-
groupCount
private final int groupCount
-
filter
private final boolean filter
-
-
Constructor Detail
-
AggCallBinding
public AggCallBinding(RelDataTypeFactory typeFactory, SqlAggFunction aggFunction, java.util.List<RelDataType> operands, int groupCount, boolean filter)
Creates an AggCallBinding- Parameters:
typeFactory
- Type factoryaggFunction
- Aggregate functionoperands
- Data types of operandsgroupCount
- Number of columns in the GROUP BY clausefilter
- Whether the aggregate function has a FILTER clause
-
-
Method Detail
-
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 classSqlOperatorBinding
-
hasFilter
public boolean hasFilter()
Description copied from class:SqlOperatorBinding
Returns whether the operator is an aggregate function with a filter.- Overrides:
hasFilter
in classSqlOperatorBinding
-
getOperandCount
public int getOperandCount()
- Specified by:
getOperandCount
in classSqlOperatorBinding
- Returns:
- the number of bound operands
-
getOperandType
public RelDataType getOperandType(int ordinal)
Description copied from class:SqlOperatorBinding
Gets the type of a bound operand.- Specified by:
getOperandType
in classSqlOperatorBinding
- Parameters:
ordinal
- zero-based ordinal of operand of interest- Returns:
- bound operand type
-
newError
public CalciteException newError(Resources.ExInst<SqlValidatorException> e)
Description copied from class:SqlOperatorBinding
Wraps a validation error with context appropriate to this operator call.- Specified by:
newError
in classSqlOperatorBinding
- Parameters:
e
- Validation error, not null- Returns:
- Error wrapped, if possible, with positional information
-
-