protected class SqlToRelConverter.Blackboard extends Object implements SqlRexContext, SqlVisitor<RexNode>
| Modifier and Type | Field and Description |
|---|---|
RelNode |
root |
SqlValidatorScope |
scope
Collection of
RelNode objects which correspond to a SELECT
statement. |
| Modifier | Constructor and Description |
|---|---|
protected |
SqlToRelConverter.Blackboard(SqlValidatorScope scope,
Map<String,RexNode> nameToNodeMap)
Creates a Blackboard.
|
| Modifier and Type | Method and Description |
|---|---|
RexNode |
convertExpression(SqlNode expr)
|
RexNode |
convertInterval(SqlIntervalQualifier intervalQualifier) |
RexNode |
convertLiteral(SqlLiteral literal)
Converts a literal.
|
RexNode |
convertSortExpression(SqlNode expr,
Set<SqlKind> flags)
Converts an item in an ORDER BY clause, extracting DESC, NULLS LAST
and NULLS FIRST flags first.
|
void |
flatten(List<RelNode> rels,
int systemFieldCount,
int[] start,
List<Pair<RelNode,Integer>> relOffsetList) |
List<SqlMonotonicity> |
getColumnMonotonicities() |
DefaultValueFactory |
getDefaultValueFactory()
Returns the factory which supplies default values for INSERT, UPDATE, and
NEW.
|
int |
getGroupCount()
If the operator call occurs in an aggregate query, returns the number of
columns in the GROUP BY clause.
|
RexBuilder |
getRexBuilder()
Returns the
RexBuilder to use to create RexNode objects. |
RexRangeRef |
getSubqueryExpr(SqlCall call)
Returns the expression used to access a given IN or EXISTS
sub-query. |
RelDataTypeFactory |
getTypeFactory()
Returns the type factory.
|
SqlValidator |
getValidator()
Returns the validator.
|
RexNode |
register(RelNode rel,
JoinRelType joinType) |
RexNode |
register(RelNode rel,
JoinRelType joinType,
List<RexNode> leftKeys)
Registers a relational expression.
|
void |
setDataset(String datasetName)
Notifies this Blackboard that the root just set using
setRoot(RelNode, boolean) was derived using dataset
substitution. |
void |
setRoot(RelNode root,
boolean leaf)
Sets a new root relational expression, as the translation process
backs its way further up the tree.
|
RexNode |
visit(SqlCall call)
Visits a call to a
SqlOperator. |
RexNode |
visit(SqlDataTypeSpec type)
Visits a datatype specification.
|
RexNode |
visit(SqlDynamicParam param)
Visits a dynamic parameter.
|
RexNode |
visit(SqlIdentifier id)
Visits an identifier.
|
RexNode |
visit(SqlIntervalQualifier intervalQualifier)
Visits an interval qualifier
|
RexNode |
visit(SqlLiteral literal)
Visits a literal.
|
RexNode |
visit(SqlNodeList nodeList)
Visits a list of
SqlNode objects. |
public final SqlValidatorScope scope
RelNode objects which correspond to a SELECT
statement.public RelNode root
protected SqlToRelConverter.Blackboard(SqlValidatorScope scope, Map<String,RexNode> nameToNodeMap)
scope - Name-resolution scope for expressions validated
within this query. Can be null if this Blackboard is
for a leaf node, saynameToNodeMap - Map which translates the expression to map a
given parameter into, if translating expressions;
null otherwisepublic RexNode register(RelNode rel, JoinRelType joinType)
public RexNode register(RelNode rel, JoinRelType joinType, List<RexNode> leftKeys)
rel - Relational expressionjoinType - Join typeleftKeys - LHS of IN clause, or null for expressions
other than INpublic void setRoot(RelNode root, boolean leaf)
root - New root relational expressionleaf - Whether the relational expression is a leaf, that is,
derived from an atomic relational expression such as a table
name in the from clause, or the projection on top of a
select-subquery. In particular, relational expressions
derived from JOIN operators are not leaves, but set
expressions are.public void setDataset(String datasetName)
setRoot(RelNode, boolean) was derived using dataset
substitution.
The default implementation is not interested in such notifications, and does nothing.
datasetName - Dataset namepublic void flatten(List<RelNode> rels, int systemFieldCount, int[] start, List<Pair<RelNode,Integer>> relOffsetList)
public RexNode convertExpression(SqlNode expr)
SqlRexContextconvertExpression in interface SqlRexContextexpr - Expression to translatepublic RexNode convertSortExpression(SqlNode expr, Set<SqlKind> flags)
public int getGroupCount()
SqlRexContextReturns 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.
getGroupCount in interface SqlRexContextSqlOperatorBinding.getGroupCount()public RexBuilder getRexBuilder()
SqlRexContextRexBuilder to use to create RexNode objects.getRexBuilder in interface SqlRexContextpublic RexRangeRef getSubqueryExpr(SqlCall call)
SqlRexContextsub-query.getSubqueryExpr in interface SqlRexContextcall - IN or EXISTS expressionpublic RelDataTypeFactory getTypeFactory()
SqlRexContextgetTypeFactory in interface SqlRexContextpublic DefaultValueFactory getDefaultValueFactory()
SqlRexContextgetDefaultValueFactory in interface SqlRexContextpublic SqlValidator getValidator()
SqlRexContextgetValidator in interface SqlRexContextpublic RexNode convertLiteral(SqlLiteral literal)
SqlRexContextconvertLiteral in interface SqlRexContextpublic RexNode convertInterval(SqlIntervalQualifier intervalQualifier)
public RexNode visit(SqlLiteral literal)
SqlVisitorvisit in interface SqlVisitor<RexNode>literal - LiteralSqlLiteral.accept(SqlVisitor)public RexNode visit(SqlCall call)
SqlVisitorSqlOperator.visit in interface SqlVisitor<RexNode>call - CallSqlCall.accept(SqlVisitor)public RexNode visit(SqlNodeList nodeList)
SqlVisitorSqlNode objects.visit in interface SqlVisitor<RexNode>nodeList - list of nodesSqlNodeList.accept(SqlVisitor)public RexNode visit(SqlIdentifier id)
SqlVisitorvisit in interface SqlVisitor<RexNode>id - identifierSqlIdentifier.accept(SqlVisitor)public RexNode visit(SqlDataTypeSpec type)
SqlVisitorvisit in interface SqlVisitor<RexNode>type - datatype specificationSqlDataTypeSpec.accept(SqlVisitor)public RexNode visit(SqlDynamicParam param)
SqlVisitorvisit in interface SqlVisitor<RexNode>param - Dynamic parameterSqlDynamicParam.accept(SqlVisitor)public RexNode visit(SqlIntervalQualifier intervalQualifier)
SqlVisitorvisit in interface SqlVisitor<RexNode>intervalQualifier - Interval qualifierSqlIntervalQualifier.accept(SqlVisitor)public List<SqlMonotonicity> getColumnMonotonicities()
Copyright © 2012–2015 The Apache Software Foundation. All rights reserved.