protected class SqlToRelConverter.AggConverter extends Object implements SqlVisitor<Void>
Consider the expression
SELECT deptno, SUM(2 * sal) FROM emp GROUP BY deptno
Then:
| Modifier and Type | Field and Description |
|---|---|
private Map<AggregateCall,RexNode> |
aggCallMapping |
private List<AggregateCall> |
aggCalls |
private Map<SqlNode,RexNode> |
aggMapping |
AggregatingSelectScope |
aggregatingSelectScope |
private Map<SqlNode,Ord<AuxiliaryConverter>> |
auxiliaryGroupExprs
The auxiliary group-by expressions.
|
private SqlToRelConverter.Blackboard |
bb |
private List<Pair<RexNode,String>> |
convertedInputExprs
Input expressions for the group columns and aggregates, in
RexNode format. |
private SqlNodeList |
groupExprs
The group-by expressions, in
SqlNode format. |
private boolean |
inOver
Are we directly inside a windowed aggregate?
|
private List<RexNode> |
midExprs
Expressions to be evaluated as rows are being placed into the
aggregate's hash table.
|
private Map<String,String> |
nameMap |
| Constructor and Description |
|---|
AggConverter(SqlToRelConverter.Blackboard bb,
SqlSelect select)
Creates an AggConverter.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
addAuxiliaryGroupExpr(SqlNode node,
int index,
AuxiliaryConverter converter) |
private void |
addExpr(RexNode expr,
String name)
Adds an expression, deducing an appropriate name if possible.
|
int |
addGroupExpr(SqlNode expr) |
List<AggregateCall> |
getAggCalls() |
List<Pair<RexNode,String>> |
getPreExprs() |
RelDataTypeFactory |
getTypeFactory() |
RexNode |
lookupAggregates(SqlCall call) |
int |
lookupGroupExpr(SqlNode expr)
If an expression is structurally identical to one of the group-by
expressions, returns a reference to the expression, otherwise returns
null.
|
private int |
lookupOrCreateGroupExpr(RexNode expr) |
private void |
translateAgg(SqlCall call,
SqlNode filter,
SqlCall outerCall) |
Void |
visit(SqlCall call)
Visits a call to a
SqlOperator. |
Void |
visit(SqlDataTypeSpec type)
Visits a datatype specification.
|
Void |
visit(SqlDynamicParam param)
Visits a dynamic parameter.
|
Void |
visit(SqlIdentifier id)
Visits an identifier.
|
Void |
visit(SqlIntervalQualifier intervalQualifier)
Visits an interval qualifier
|
Void |
visit(SqlLiteral lit)
Visits a literal.
|
Void |
visit(SqlNodeList nodeList)
Visits a list of
SqlNode objects. |
private final SqlToRelConverter.Blackboard bb
public final AggregatingSelectScope aggregatingSelectScope
private final SqlNodeList groupExprs
SqlNode format.private final Map<SqlNode,Ord<AuxiliaryConverter>> auxiliaryGroupExprs
private final List<Pair<RexNode,String>> convertedInputExprs
RexNode format. The first elements of the list correspond to the
elements in groupExprs; the remaining elements are for
aggregates. The right field of each pair is the name of the expression,
where the expressions are simple mappings to input fields.private final List<RexNode> midExprs
private final List<AggregateCall> aggCalls
private final Map<AggregateCall,RexNode> aggCallMapping
private boolean inOver
public AggConverter(SqlToRelConverter.Blackboard bb, SqlSelect select)
The select parameter provides enough context to name
aggregate calls which are top-level select list items.
bb - Blackboardselect - Query being translated; provides context to givepublic int addGroupExpr(SqlNode expr)
void addAuxiliaryGroupExpr(SqlNode node, int index, AuxiliaryConverter converter)
private void addExpr(RexNode expr, String name)
expr - Expressionname - Suggested namepublic Void visit(SqlIdentifier id)
SqlVisitorvisit in interface SqlVisitor<Void>id - identifierSqlIdentifier.accept(SqlVisitor)public Void visit(SqlNodeList nodeList)
SqlVisitorSqlNode objects.visit in interface SqlVisitor<Void>nodeList - list of nodesSqlNodeList.accept(SqlVisitor)public Void visit(SqlLiteral lit)
SqlVisitorvisit in interface SqlVisitor<Void>lit - LiteralSqlLiteral.accept(SqlVisitor)public Void visit(SqlDataTypeSpec type)
SqlVisitorvisit in interface SqlVisitor<Void>type - datatype specificationSqlDataTypeSpec.accept(SqlVisitor)public Void visit(SqlDynamicParam param)
SqlVisitorvisit in interface SqlVisitor<Void>param - Dynamic parameterSqlDynamicParam.accept(SqlVisitor)public Void visit(SqlIntervalQualifier intervalQualifier)
SqlVisitorvisit in interface SqlVisitor<Void>intervalQualifier - Interval qualifierSqlIntervalQualifier.accept(SqlVisitor)public Void visit(SqlCall call)
SqlVisitorSqlOperator.visit in interface SqlVisitor<Void>call - CallSqlCall.accept(SqlVisitor)private int lookupOrCreateGroupExpr(RexNode expr)
public int lookupGroupExpr(SqlNode expr)
public List<AggregateCall> getAggCalls()
public RelDataTypeFactory getTypeFactory()
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.