Package org.apache.calcite.sql2rel
Class SqlToRelConverter.AggConverter
java.lang.Object
org.apache.calcite.sql2rel.SqlToRelConverter.AggConverter
- All Implemented Interfaces:
org.apache.calcite.sql.util.SqlVisitor<Void>
- Enclosing class:
- SqlToRelConverter
protected class SqlToRelConverter.AggConverter
extends Object
implements org.apache.calcite.sql.util.SqlVisitor<Void>
Converts expressions to aggregates.
Consider the expression
SELECT deptno, SUM(2 * sal) FROM emp GROUP BY deptno
Then:
- groupExprs = {SqlIdentifier(deptno)}
- convertedInputExprs = {RexInputRef(deptno), 2 * RefInputRef(sal)}
- inputRefs = {RefInputRef(#0), RexInputRef(#1)}
- aggCalls = {AggCall(SUM, {1})}
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal @Nullable org.apache.calcite.sql.validate.AggregatingSelectScope
-
Constructor Summary
ConstructorsConstructorDescriptionAggConverter
(SqlToRelConverter.Blackboard bb, org.apache.calcite.sql.SqlSelect select) Creates an AggConverter. -
Method Summary
Modifier and TypeMethodDescriptionint
addGroupExpr
(org.apache.calcite.sql.SqlNode expr) List<org.apache.calcite.rel.core.AggregateCall>
org.apache.calcite.rel.type.RelDataTypeFactory
@Nullable org.apache.calcite.rex.RexNode
lookupAggregates
(org.apache.calcite.sql.SqlCall call) int
lookupGroupExpr
(org.apache.calcite.sql.SqlNode expr) If an expression is structurally identical to one of the group-by expressions, returns a reference to the expression, otherwise returns null.visit
(org.apache.calcite.sql.SqlCall call) visit
(org.apache.calcite.sql.SqlDataTypeSpec type) visit
(org.apache.calcite.sql.SqlDynamicParam param) visit
(org.apache.calcite.sql.SqlIdentifier id) visit
(org.apache.calcite.sql.SqlIntervalQualifier intervalQualifier) visit
(org.apache.calcite.sql.SqlLiteral lit) visit
(org.apache.calcite.sql.SqlNodeList nodeList) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.calcite.sql.util.SqlVisitor
visitNode
-
Field Details
-
aggregatingSelectScope
public final @Nullable org.apache.calcite.sql.validate.AggregatingSelectScope aggregatingSelectScope
-
-
Constructor Details
-
AggConverter
Creates an AggConverter.The
select
parameter provides enough context to name aggregate calls which are top-level select list items.- Parameters:
bb
- Blackboardselect
- Query being translated; provides context to give
-
-
Method Details
-
addGroupExpr
public int addGroupExpr(org.apache.calcite.sql.SqlNode expr) -
visit
- Specified by:
visit
in interfaceorg.apache.calcite.sql.util.SqlVisitor<Void>
-
visit
- Specified by:
visit
in interfaceorg.apache.calcite.sql.util.SqlVisitor<Void>
-
visit
- Specified by:
visit
in interfaceorg.apache.calcite.sql.util.SqlVisitor<Void>
-
visit
- Specified by:
visit
in interfaceorg.apache.calcite.sql.util.SqlVisitor<Void>
-
visit
- Specified by:
visit
in interfaceorg.apache.calcite.sql.util.SqlVisitor<Void>
-
visit
- Specified by:
visit
in interfaceorg.apache.calcite.sql.util.SqlVisitor<Void>
-
visit
- Specified by:
visit
in interfaceorg.apache.calcite.sql.util.SqlVisitor<Void>
-
lookupGroupExpr
public int lookupGroupExpr(org.apache.calcite.sql.SqlNode expr) If an expression is structurally identical to one of the group-by expressions, returns a reference to the expression, otherwise returns null. -
lookupAggregates
public @Nullable org.apache.calcite.rex.RexNode lookupAggregates(org.apache.calcite.sql.SqlCall call) -
getPreExprs
-
getAggCalls
-
getTypeFactory
public org.apache.calcite.rel.type.RelDataTypeFactory getTypeFactory()
-