|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.sql2rel.SqlToRelConverter.Blackboard
protected class SqlToRelConverter.Blackboard
Workspace for translating an individual SELECT statement (or sub-SELECT).
Field Summary | |
---|---|
(package private) SqlToRelConverter.AggConverter |
agg
Workspace for building aggregates. |
private List<SqlMonotonicity> |
columnMonotonicities
|
(package private) List<RelNode> |
cursors
|
private RelNode[] |
inputs
|
private Map<String,RexNode> |
mapCorrelateVariableToRexNode
|
private Map<RelNode,Map<Integer,Integer>> |
mapRootRelToFieldProjection
Project the groupby expressions out of the root of this sub-select. |
private Map<SqlNode,RexNode> |
mapSubqueryToExpr
Maps IN and EXISTS sub-queries to the expressions
which will be used to access them. |
private Map<String,RexNode> |
nameToNodeMap
|
RelNode |
root
|
SqlValidatorScope |
scope
Collection of RelNode objects which correspond to a SELECT
statement. |
private List<SqlNode> |
subqueryList
List of IN and EXISTS nodes inside this
SELECT statement (but not inside sub-queries). |
private boolean |
subqueryNeedsOuterJoin
|
private List<RelDataTypeField> |
systemFieldList
|
Constructor Summary | |
---|---|
protected |
SqlToRelConverter.Blackboard(SqlValidatorScope scope,
Map<String,RexNode> nameToNodeMap)
Creates a Blackboard. |
Method Summary | |
---|---|
void |
adjustSubqueries(int index,
int count)
Shifts the expressions used to reference subqueries to the right. |
RexNode |
convertExpression(SqlNode expr)
Converts an expression from SqlNode to RexNode format. |
RexNode |
convertInterval(SqlIntervalQualifier intervalQualifier)
|
RexNode |
convertLiteral(SqlLiteral literal)
Converts a literal. |
void |
flatten(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. |
RexBuilder |
getRexBuilder()
Returns the RexBuilder to use to create RexNode objects. |
(package private) RelDataTypeField |
getRootField(RexInputRef inputRef)
|
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. |
private boolean |
isConvertedSubq(RexNode rex)
Determines whether a RexNode corresponds to a subquery that's been converted to a constant. |
(package private) RexNode |
lookup(int offset,
SqlToRelConverter.LookupContext lookupContext)
Creates an expression with which to reference the expression whose offset in its from-list is offset . |
(package private) RexNode |
lookupExp(String name)
Returns an expression with which to reference a from-list item. |
RexNode |
register(RelNode rel,
JoinRelType joinType)
|
RexNode |
register(RelNode rel,
JoinRelType joinType,
RexNode[] leftJoinKeysForIn)
Registers a relational expression. |
(package private) void |
registerSubquery(SqlNode node)
|
(package private) RelNode[] |
retrieveCursors()
|
void |
setDataset(String datasetName)
Notifies this Blackboard that the root just set using setRoot(RelNode, boolean) was derived using dataset substitution. |
(package private) void |
setRoot(RelNode[] inputs)
|
private void |
setRoot(RelNode[] inputs,
RelNode root,
boolean hasSystemFields)
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final SqlValidatorScope scope
RelNode
objects which correspond to a SELECT
statement.
private final Map<String,RexNode> nameToNodeMap
public RelNode root
private RelNode[] inputs
private final Map<String,RexNode> mapCorrelateVariableToRexNode
List<RelNode> cursors
private final List<SqlNode> subqueryList
IN
and EXISTS
nodes inside this
SELECT
statement (but not inside sub-queries).
private final Map<SqlNode,RexNode> mapSubqueryToExpr
sub-queries
to the expressions
which will be used to access them.
private boolean subqueryNeedsOuterJoin
SqlToRelConverter.AggConverter agg
private final Map<RelNode,Map<Integer,Integer>> mapRootRelToFieldProjection
private final List<SqlMonotonicity> columnMonotonicities
private final List<RelDataTypeField> systemFieldList
Constructor Detail |
---|
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 otherwiseMethod Detail |
---|
public RexNode register(RelNode rel, JoinRelType joinType)
public RexNode register(RelNode rel, JoinRelType joinType, RexNode[] leftJoinKeysForIn)
rel
- Relational expressionjoinType
- Join typeleftJoinKeysForIn
- LHS of IN clause, or null for expressions
other than IN
public 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.private void setRoot(RelNode[] inputs, RelNode root, boolean hasSystemFields)
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 namevoid setRoot(RelNode[] inputs)
RexNode lookupExp(String name)
name
- the alias of the from item
RexFieldAccess
or RexRangeRef
, or null if
not foundRexNode lookup(int offset, SqlToRelConverter.LookupContext lookupContext)
offset
.
RelDataTypeField getRootField(RexInputRef inputRef)
public void flatten(RelNode[] rels, int systemFieldCount, int[] start, List<Pair<RelNode,Integer>> relOffsetList)
void registerSubquery(SqlNode node)
RelNode[] retrieveCursors()
public RexNode convertExpression(SqlNode expr)
SqlRexContext
SqlNode
to RexNode
format.
convertExpression
in interface SqlRexContext
expr
- Expression to translate
private boolean isConvertedSubq(RexNode rex)
rex
- the expression to be examined
public RexBuilder getRexBuilder()
SqlRexContext
RexBuilder
to use to create RexNode
objects.
getRexBuilder
in interface SqlRexContext
public RexRangeRef getSubqueryExpr(SqlCall call)
SqlRexContext
sub-query
.
getSubqueryExpr
in interface SqlRexContext
call
- IN or EXISTS expression
public RelDataTypeFactory getTypeFactory()
SqlRexContext
getTypeFactory
in interface SqlRexContext
public DefaultValueFactory getDefaultValueFactory()
SqlRexContext
getDefaultValueFactory
in interface SqlRexContext
public SqlValidator getValidator()
SqlRexContext
getValidator
in interface SqlRexContext
public RexNode convertLiteral(SqlLiteral literal)
SqlRexContext
convertLiteral
in interface SqlRexContext
public RexNode convertInterval(SqlIntervalQualifier intervalQualifier)
public RexNode visit(SqlLiteral literal)
SqlVisitor
visit
in interface SqlVisitor<RexNode>
literal
- LiteralSqlLiteral.accept(SqlVisitor)
public RexNode visit(SqlCall call)
SqlVisitor
SqlOperator
.
visit
in interface SqlVisitor<RexNode>
call
- CallSqlCall.accept(SqlVisitor)
public RexNode visit(SqlNodeList nodeList)
SqlVisitor
SqlNode
objects.
visit
in interface SqlVisitor<RexNode>
nodeList
- list of nodesSqlNodeList.accept(SqlVisitor)
public RexNode visit(SqlIdentifier id)
SqlVisitor
visit
in interface SqlVisitor<RexNode>
id
- identifierSqlIdentifier.accept(SqlVisitor)
public RexNode visit(SqlDataTypeSpec type)
SqlVisitor
visit
in interface SqlVisitor<RexNode>
type
- datatype specificationSqlDataTypeSpec.accept(SqlVisitor)
public RexNode visit(SqlDynamicParam param)
SqlVisitor
visit
in interface SqlVisitor<RexNode>
param
- Dynamic parameterSqlDynamicParam.accept(SqlVisitor)
public RexNode visit(SqlIntervalQualifier intervalQualifier)
SqlVisitor
visit
in interface SqlVisitor<RexNode>
intervalQualifier
- Interval qualifierSqlIntervalQualifier.accept(SqlVisitor)
public void adjustSubqueries(int index, int count)
index
count
places
to the right.
index
- Position where new expression was insertedcount
- Number of new expressions insertedpublic List<SqlMonotonicity> getColumnMonotonicities()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |