public class SqlToRelConverter extends Object
SqlNode
objects) into a relational algebra
expression (consisting of RelNode
objects).
The public entry points are: convertQuery(org.apache.calcite.sql.SqlNode, boolean, boolean)
, convertExpression(SqlNode)
.
Modifier and Type | Class and Description |
---|---|
protected class |
SqlToRelConverter.AggConverter
Converts expressions to aggregates.
|
protected class |
SqlToRelConverter.Blackboard
Workspace for translating an individual SELECT statement (or sub-SELECT).
|
static interface |
SqlToRelConverter.Config
Interface to define the configuration for a SqlToRelConverter.
|
static class |
SqlToRelConverter.ConfigBuilder
Deprecated.
|
Modifier and Type | Field and Description |
---|---|
protected org.apache.calcite.prepare.Prepare.CatalogReader |
catalogReader |
protected org.apache.calcite.plan.RelOptCluster |
cluster |
SqlToRelConverter.Config |
config |
static int |
DEFAULT_IN_SUB_QUERY_THRESHOLD
Size of the smallest IN list that will be converted to a semijoin to a static table.
|
static int |
DEFAULT_IN_SUBQUERY_THRESHOLD
Deprecated.
|
protected Map<org.apache.calcite.rel.RelNode,Integer> |
leaves |
protected org.apache.calcite.rex.RexBuilder |
rexBuilder |
protected static org.slf4j.Logger |
SQL2REL_LOGGER |
protected org.apache.calcite.rel.type.RelDataTypeFactory |
typeFactory |
protected org.apache.calcite.sql.validate.SqlValidator |
validator |
org.apache.calcite.plan.RelOptTable.ViewExpander |
viewExpander |
Constructor and Description |
---|
SqlToRelConverter(org.apache.calcite.plan.RelOptTable.ViewExpander viewExpander,
org.apache.calcite.sql.validate.SqlValidator validator,
org.apache.calcite.prepare.Prepare.CatalogReader catalogReader,
org.apache.calcite.plan.RelOptCluster cluster,
org.apache.calcite.sql2rel.SqlRexConvertletTable convertletTable)
Deprecated.
|
SqlToRelConverter(org.apache.calcite.plan.RelOptTable.ViewExpander viewExpander,
org.apache.calcite.sql.validate.SqlValidator validator,
org.apache.calcite.prepare.Prepare.CatalogReader catalogReader,
org.apache.calcite.plan.RelOptCluster cluster,
org.apache.calcite.sql2rel.SqlRexConvertletTable convertletTable,
SqlToRelConverter.Config config) |
SqlToRelConverter(org.apache.calcite.plan.RelOptTable.ViewExpander viewExpander,
org.apache.calcite.sql.validate.SqlValidator validator,
org.apache.calcite.prepare.Prepare.CatalogReader catalogReader,
org.apache.calcite.plan.RelOptPlanner planner,
org.apache.calcite.rex.RexBuilder rexBuilder,
org.apache.calcite.sql2rel.SqlRexConvertletTable convertletTable)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
addConvertedNonCorrSubqs(Map<org.apache.calcite.sql.SqlNode,org.apache.calcite.rex.RexNode> alreadyConvertedNonCorrSubqs)
Adds to the current map of non-correlated converted sub-queries the elements from another map
that contains non-correlated sub-queries that have been converted by another
SqlToRelConverter.
|
protected org.apache.calcite.rex.RexNode |
adjustInputRef(SqlToRelConverter.Blackboard bb,
org.apache.calcite.rex.RexInputRef inputRef)
Adjusts the type of a reference to an input field to account for nulls introduced by outer
joins; and adjusts the offset to match the physical implementation.
|
protected void |
afterTableFunction(SqlToRelConverter.Blackboard bb,
org.apache.calcite.sql.SqlCall call,
org.apache.calcite.rel.logical.LogicalTableFunctionScan callRel) |
protected void |
collectInsertTargets(org.apache.calcite.sql.SqlInsert call,
org.apache.calcite.rex.RexNode sourceRef,
List<String> targetColumnNames,
List<org.apache.calcite.rex.RexNode> columnExprs)
Given an INSERT statement, collects the list of names to be populated and the expressions to
put in them.
|
static SqlToRelConverter.Config |
config()
Returns a default
SqlToRelConverter.Config . |
static SqlToRelConverter.ConfigBuilder |
configBuilder()
Deprecated.
|
void |
containsJoinHint()
To tell this converter that this SqlNode tree contains join hint and then a query block alias
will be attached to the root node of the query block.
|
protected void |
convertAgg(SqlToRelConverter.Blackboard bb,
org.apache.calcite.sql.SqlSelect select,
List<org.apache.calcite.sql.SqlNode> orderExprList)
Converts the SELECT, GROUP BY and HAVING clauses of an aggregate query.
|
protected void |
convertCollectionTable(SqlToRelConverter.Blackboard bb,
org.apache.calcite.sql.SqlCall call) |
protected org.apache.calcite.rel.RelNode |
convertColumnList(org.apache.calcite.sql.SqlInsert call,
org.apache.calcite.rel.RelNode source)
Creates a source for an INSERT statement.
|
org.apache.calcite.rex.RexDynamicParam |
convertDynamicParam(org.apache.calcite.sql.SqlDynamicParam dynamicParam) |
org.apache.calcite.rex.RexNode |
convertExpression(org.apache.calcite.sql.SqlNode node)
Converts an expression from
SqlNode to RexNode format. |
org.apache.calcite.rex.RexNode |
convertExpression(org.apache.calcite.sql.SqlNode node,
Map<String,org.apache.calcite.rex.RexNode> nameToNodeMap)
Converts an expression from
SqlNode to RexNode format, mapping identifier
references to predefined expressions. |
protected org.apache.calcite.rex.RexNode |
convertExtendedExpression(org.apache.calcite.sql.SqlNode node,
SqlToRelConverter.Blackboard bb)
Converts a non-standard expression.
|
protected void |
convertFrom(SqlToRelConverter.Blackboard bb,
org.apache.calcite.sql.SqlNode from) |
protected void |
convertFrom(SqlToRelConverter.Blackboard bb,
org.apache.calcite.sql.SqlNode from,
List<String> fieldNames)
Converts a FROM clause into a relational expression.
|
protected org.apache.calcite.rel.RelNode |
convertInsert(org.apache.calcite.sql.SqlInsert call) |
protected void |
convertMatchRecognize(SqlToRelConverter.Blackboard bb,
SqlMatchRecognize matchRecognize) |
protected void |
convertOrder(org.apache.calcite.sql.SqlSelect select,
SqlToRelConverter.Blackboard bb,
org.apache.calcite.rel.RelCollation collation,
List<org.apache.calcite.sql.SqlNode> orderExprList,
org.apache.calcite.sql.SqlNode offset,
org.apache.calcite.sql.SqlNode fetch)
Converts a query's ORDER BY clause, if any.
|
protected org.apache.calcite.rel.RelFieldCollation |
convertOrderItem(org.apache.calcite.sql.SqlSelect select,
org.apache.calcite.sql.SqlNode orderItem,
List<org.apache.calcite.sql.SqlNode> extraExprs,
org.apache.calcite.rel.RelFieldCollation.Direction direction,
org.apache.calcite.rel.RelFieldCollation.NullDirection nullDirection) |
protected void |
convertPivot(SqlToRelConverter.Blackboard bb,
org.apache.calcite.sql.SqlPivot pivot) |
org.apache.calcite.rel.RelRoot |
convertQuery(org.apache.calcite.sql.SqlNode query,
boolean needsValidation,
boolean top)
Converts an unvalidated query's parse tree into a relational expression.
|
protected org.apache.calcite.rel.RelRoot |
convertQueryRecursive(org.apache.calcite.sql.SqlNode query,
boolean top,
org.apache.calcite.rel.type.RelDataType targetRowType)
Recursively converts a query to a relational expression.
|
org.apache.calcite.rel.RelNode |
convertSelect(org.apache.calcite.sql.SqlSelect select,
boolean top)
Converts a SELECT statement's parse tree into a relational expression.
|
protected void |
convertSelectImpl(SqlToRelConverter.Blackboard bb,
org.apache.calcite.sql.SqlSelect select)
Implementation of
convertSelect(SqlSelect, boolean) ; derived class may override. |
protected org.apache.calcite.rel.RelNode |
convertSetOp(org.apache.calcite.sql.SqlCall call)
Converts a set operation (UNION, INTERSECT, MINUS) into relational expressions.
|
org.apache.calcite.rel.RelNode |
convertToSingleValueSubq(org.apache.calcite.sql.SqlNode query,
org.apache.calcite.rel.RelNode plan)
Converts the RelNode tree for a select statement to a select that produces a single value.
|
org.apache.calcite.rel.RelNode |
convertValues(org.apache.calcite.sql.SqlCall values,
org.apache.calcite.rel.type.RelDataType targetRowType)
Converts a SELECT statement's parse tree into a relational expression.
|
org.apache.calcite.rel.RelRoot |
convertWith(org.apache.calcite.sql.SqlWith with,
boolean top)
Converts a WITH sub-query into a relational expression.
|
protected void |
createAggImpl(SqlToRelConverter.Blackboard bb,
SqlToRelConverter.AggConverter aggConverter,
org.apache.calcite.sql.SqlNodeList selectList,
org.apache.calcite.sql.SqlNodeList groupList,
org.apache.calcite.sql.SqlNode having,
List<org.apache.calcite.sql.SqlNode> orderExprList) |
protected org.apache.calcite.rel.RelNode |
createAggregate(SqlToRelConverter.Blackboard bb,
org.apache.calcite.util.ImmutableBitSet groupSet,
com.google.common.collect.ImmutableList<org.apache.calcite.util.ImmutableBitSet> groupSets,
List<org.apache.calcite.rel.core.AggregateCall> aggCalls)
Creates an Aggregate.
|
protected SqlToRelConverter.Blackboard |
createBlackboard(org.apache.calcite.sql.validate.SqlValidatorScope scope,
Map<String,org.apache.calcite.rex.RexNode> nameToNodeMap,
boolean top)
Factory method for creating translation workspace.
|
protected org.apache.calcite.rel.RelNode |
createJoin(SqlToRelConverter.Blackboard bb,
org.apache.calcite.rel.RelNode leftRel,
org.apache.calcite.rel.RelNode rightRel,
org.apache.calcite.rex.RexNode joinCond,
org.apache.calcite.rel.core.JoinRelType joinType) |
org.apache.calcite.rel.RelNode |
decorrelate(org.apache.calcite.sql.SqlNode query,
org.apache.calcite.rel.RelNode rootRel)
If sub-query is correlated and decorrelation is enabled, performs decorrelation.
|
protected org.apache.calcite.rel.RelNode |
decorrelateQuery(org.apache.calcite.rel.RelNode rootRel) |
protected boolean |
enableDecorrelation()
Deprecated.
|
protected void |
extraSelectItems(SqlToRelConverter.Blackboard bb,
org.apache.calcite.sql.SqlSelect select,
List<org.apache.calcite.rex.RexNode> exprList,
List<String> nameList,
Collection<String> aliasList,
List<org.apache.calcite.sql.validate.SqlMonotonicity> columnMonotonicityList)
Adds extra select items.
|
org.apache.calcite.rel.RelNode |
flattenTypes(org.apache.calcite.rel.RelNode rootRel,
boolean restructure) |
protected void |
gatherOrderExprs(SqlToRelConverter.Blackboard bb,
org.apache.calcite.sql.SqlSelect select,
org.apache.calcite.sql.SqlNodeList orderList,
List<org.apache.calcite.sql.SqlNode> extraOrderExprs,
List<org.apache.calcite.rel.RelFieldCollation> collationList)
Creates a list of collations required to implement the ORDER BY clause, if there is one.
|
org.apache.calcite.plan.RelOptCluster |
getCluster()
Returns the RelOptCluster in use.
|
int |
getDynamicParamCount()
Returns the number of dynamic parameters encountered during translation; this must only be
called after
convertQuery(org.apache.calcite.sql.SqlNode, boolean, boolean) . |
int |
getDynamicParamCountInExplain(boolean increment)
Returns the current count of the number of dynamic parameters in an EXPLAIN PLAN statement.
|
org.apache.calcite.rel.type.RelDataType |
getDynamicParamType(int index)
Returns the type inferred for a dynamic parameter.
|
protected int |
getInSubqueryThreshold()
Deprecated.
|
Map<org.apache.calcite.sql.SqlNode,org.apache.calcite.rex.RexNode> |
getMapConvertedNonCorrSubqs()
Returns the mapping of non-correlated sub-queries that have been converted to the constants
that they evaluate to.
|
org.apache.calcite.rex.RexBuilder |
getRexBuilder()
Returns the row-expression builder.
|
protected List<org.apache.calcite.rel.type.RelDataTypeField> |
getSystemFields()
Returns a list of fields to be prefixed to each relational expression.
|
protected org.apache.calcite.plan.RelOptTable |
getTargetTable(org.apache.calcite.sql.SqlNode call) |
static boolean |
isOrdered(org.apache.calcite.sql.SqlNode query) |
boolean |
isTrimUnusedFields()
Deprecated.
|
protected org.apache.calcite.sql2rel.RelFieldTrimmer |
newFieldTrimmer()
Creates a RelFieldTrimmer.
|
void |
setDynamicParamCountInExplain(int explainParamCount)
Sets the number of dynamic parameters in the current EXPLAIN PLAN statement.
|
void |
setSubQueryConverter(org.apache.calcite.sql2rel.SubQueryConverter converter)
Sets a new SubQueryConverter.
|
org.apache.calcite.rel.RelNode |
toRel(org.apache.calcite.plan.RelOptTable table,
List<org.apache.calcite.rel.hint.RelHint> hints) |
org.apache.calcite.rel.RelNode |
trimUnusedFields(boolean ordered,
org.apache.calcite.rel.RelNode rootRel)
Walks over a tree of relational expressions, replacing each
RelNode with a 'slimmed
down' relational expression that projects only the fields required by its consumer. |
protected static final org.slf4j.Logger SQL2REL_LOGGER
public static final int DEFAULT_IN_SUB_QUERY_THRESHOLD
@Deprecated public static final int DEFAULT_IN_SUBQUERY_THRESHOLD
protected final org.apache.calcite.sql.validate.SqlValidator validator
protected final org.apache.calcite.rex.RexBuilder rexBuilder
protected final org.apache.calcite.prepare.Prepare.CatalogReader catalogReader
protected final org.apache.calcite.plan.RelOptCluster cluster
protected final org.apache.calcite.rel.type.RelDataTypeFactory typeFactory
public final SqlToRelConverter.Config config
public final org.apache.calcite.plan.RelOptTable.ViewExpander viewExpander
@Deprecated public SqlToRelConverter(org.apache.calcite.plan.RelOptTable.ViewExpander viewExpander, org.apache.calcite.sql.validate.SqlValidator validator, org.apache.calcite.prepare.Prepare.CatalogReader catalogReader, org.apache.calcite.plan.RelOptPlanner planner, org.apache.calcite.rex.RexBuilder rexBuilder, org.apache.calcite.sql2rel.SqlRexConvertletTable convertletTable)
viewExpander
- Preparing statementvalidator
- ValidatorcatalogReader
- Schemaplanner
- PlannerrexBuilder
- Rex builderconvertletTable
- Expression converter@Deprecated public SqlToRelConverter(org.apache.calcite.plan.RelOptTable.ViewExpander viewExpander, org.apache.calcite.sql.validate.SqlValidator validator, org.apache.calcite.prepare.Prepare.CatalogReader catalogReader, org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.sql2rel.SqlRexConvertletTable convertletTable)
public SqlToRelConverter(org.apache.calcite.plan.RelOptTable.ViewExpander viewExpander, org.apache.calcite.sql.validate.SqlValidator validator, org.apache.calcite.prepare.Prepare.CatalogReader catalogReader, org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.sql2rel.SqlRexConvertletTable convertletTable, SqlToRelConverter.Config config)
public org.apache.calcite.plan.RelOptCluster getCluster()
public org.apache.calcite.rex.RexBuilder getRexBuilder()
public int getDynamicParamCount()
convertQuery(org.apache.calcite.sql.SqlNode, boolean, boolean)
.public org.apache.calcite.rel.type.RelDataType getDynamicParamType(int index)
index
- 0-based index of dynamic parameterpublic int getDynamicParamCountInExplain(boolean increment)
increment
- if true, increment the countpublic Map<org.apache.calcite.sql.SqlNode,org.apache.calcite.rex.RexNode> getMapConvertedNonCorrSubqs()
public void addConvertedNonCorrSubqs(Map<org.apache.calcite.sql.SqlNode,org.apache.calcite.rex.RexNode> alreadyConvertedNonCorrSubqs)
alreadyConvertedNonCorrSubqs
- the other mappublic void setSubQueryConverter(org.apache.calcite.sql2rel.SubQueryConverter converter)
converter
- new SubQueryConverterpublic void setDynamicParamCountInExplain(int explainParamCount)
explainParamCount
- number of dynamic parameters in the statementpublic org.apache.calcite.rel.RelNode flattenTypes(org.apache.calcite.rel.RelNode rootRel, boolean restructure)
public org.apache.calcite.rel.RelNode decorrelate(org.apache.calcite.sql.SqlNode query, org.apache.calcite.rel.RelNode rootRel)
query
- QueryrootRel
- Root relational expressionpublic org.apache.calcite.rel.RelNode trimUnusedFields(boolean ordered, org.apache.calcite.rel.RelNode rootRel)
RelNode
with a 'slimmed
down' relational expression that projects only the fields required by its consumer.
This may make things easier for the optimizer, by removing crud that would expand the
search space, but is difficult for the optimizer itself to do it, because optimizer rules
must preserve the number and type of fields. Hence, this transform that operates on the
entire tree, similar to the type-flattening transform
.
Currently this functionality is disabled in farrago/luciddb; the default implementation of this method does nothing.
ordered
- Whether the relational expression must produce results in a particular order
(typically because it has an ORDER BY at top level)rootRel
- Relational expression that is at the root of the treeprotected org.apache.calcite.sql2rel.RelFieldTrimmer newFieldTrimmer()
public org.apache.calcite.rel.RelRoot convertQuery(org.apache.calcite.sql.SqlNode query, boolean needsValidation, boolean top)
query
- Query to convertneedsValidation
- Whether to validate the query before converting; false
if
the query has already been validated.top
- Whether the query is top-level, say if its result will become a JDBC result set;
false
if the query will be part of a view.public static boolean isOrdered(org.apache.calcite.sql.SqlNode query)
public org.apache.calcite.rel.RelNode convertSelect(org.apache.calcite.sql.SqlSelect select, boolean top)
protected SqlToRelConverter.Blackboard createBlackboard(org.apache.calcite.sql.validate.SqlValidatorScope scope, Map<String,org.apache.calcite.rex.RexNode> nameToNodeMap, boolean top)
protected void convertSelectImpl(SqlToRelConverter.Blackboard bb, org.apache.calcite.sql.SqlSelect select)
convertSelect(SqlSelect, boolean)
; derived class may override.protected void convertOrder(org.apache.calcite.sql.SqlSelect select, SqlToRelConverter.Blackboard bb, org.apache.calcite.rel.RelCollation collation, List<org.apache.calcite.sql.SqlNode> orderExprList, org.apache.calcite.sql.SqlNode offset, org.apache.calcite.sql.SqlNode fetch)
Ignores the ORDER BY clause if the query is not top-level and FETCH or OFFSET are not present.
select
- Querybb
- Blackboardcollation
- Collation listorderExprList
- Method populates this list with orderBy expressions not present in
selectListoffset
- Expression for number of rows to discard before returning first rowfetch
- Expression for number of rows to fetchpublic org.apache.calcite.rel.RelNode convertToSingleValueSubq(org.apache.calcite.sql.SqlNode query, org.apache.calcite.rel.RelNode plan)
query
- the queryplan
- the original RelNode tree corresponding to the statement@Deprecated protected int getInSubqueryThreshold()
convertInToOr(org.apache.calcite.sql2rel.SqlToRelConverter.Blackboard, java.util.List<org.apache.calcite.rex.RexNode>, org.apache.calcite.sql.SqlNodeList, org.apache.calcite.sql.fun.SqlInOperator)
is used. Lists of this size
or greater will instead be converted to use a join against an inline table (LogicalValues
) rather than a predicate. A threshold of 0 forces usage of an inline table in
all cases; a threshold of Integer.MAX_VALUE forces usage of OR in all casesDEFAULT_IN_SUB_QUERY_THRESHOLD
public org.apache.calcite.rex.RexNode convertExpression(org.apache.calcite.sql.SqlNode node)
SqlNode
to RexNode
format.node
- Expression to translatepublic org.apache.calcite.rex.RexNode convertExpression(org.apache.calcite.sql.SqlNode node, Map<String,org.apache.calcite.rex.RexNode> nameToNodeMap)
SqlNode
to RexNode
format, mapping identifier
references to predefined expressions.node
- Expression to translatenameToNodeMap
- map from String to RexNode
; when an SqlIdentifier
is
encountered, it is used as a key and translated to the corresponding value from this mapprotected org.apache.calcite.rex.RexNode convertExtendedExpression(org.apache.calcite.sql.SqlNode node, SqlToRelConverter.Blackboard bb)
This method is an extension-point that derived classes can override. If this method returns a null result, the normal expression translation process will proceed. The default implementation always returns null.
node
- Expressionbb
- Blackboardprotected void convertFrom(SqlToRelConverter.Blackboard bb, org.apache.calcite.sql.SqlNode from)
public void containsJoinHint()
The `containsJoinHint` is false default to be compatible with previous behavior and then planner can reuse some node.
TODO At present, it is a relatively hacked way
protected void convertFrom(SqlToRelConverter.Blackboard bb, org.apache.calcite.sql.SqlNode from, List<String> fieldNames)
bb
- Scope within which to resolve identifiersfrom
- FROM clause of a query. Examples include:
fieldNames
- Field aliases, usually come from AS clauseprotected void convertMatchRecognize(SqlToRelConverter.Blackboard bb, SqlMatchRecognize matchRecognize)
protected void convertPivot(SqlToRelConverter.Blackboard bb, org.apache.calcite.sql.SqlPivot pivot)
protected void convertCollectionTable(SqlToRelConverter.Blackboard bb, org.apache.calcite.sql.SqlCall call)
protected void afterTableFunction(SqlToRelConverter.Blackboard bb, org.apache.calcite.sql.SqlCall call, org.apache.calcite.rel.logical.LogicalTableFunctionScan callRel)
protected org.apache.calcite.rel.RelNode createJoin(SqlToRelConverter.Blackboard bb, org.apache.calcite.rel.RelNode leftRel, org.apache.calcite.rel.RelNode rightRel, org.apache.calcite.rex.RexNode joinCond, org.apache.calcite.rel.core.JoinRelType joinType)
protected List<org.apache.calcite.rel.type.RelDataTypeField> getSystemFields()
protected void convertAgg(SqlToRelConverter.Blackboard bb, org.apache.calcite.sql.SqlSelect select, List<org.apache.calcite.sql.SqlNode> orderExprList)
This method extracts SELECT, GROUP BY and HAVING clauses, and creates an SqlToRelConverter.AggConverter
, then delegates to createAggImpl(org.apache.calcite.sql2rel.SqlToRelConverter.Blackboard, org.apache.calcite.sql2rel.SqlToRelConverter.AggConverter, org.apache.calcite.sql.SqlNodeList, org.apache.calcite.sql.SqlNodeList, org.apache.calcite.sql.SqlNode, java.util.List<org.apache.calcite.sql.SqlNode>)
. Derived class may override this
method to change any of those clauses or specify a different SqlToRelConverter.AggConverter
.
bb
- Scope within which to resolve identifiersselect
- QueryorderExprList
- Additional expressions needed to implement ORDER BYprotected final void createAggImpl(SqlToRelConverter.Blackboard bb, SqlToRelConverter.AggConverter aggConverter, org.apache.calcite.sql.SqlNodeList selectList, org.apache.calcite.sql.SqlNodeList groupList, org.apache.calcite.sql.SqlNode having, List<org.apache.calcite.sql.SqlNode> orderExprList)
protected org.apache.calcite.rel.RelNode createAggregate(SqlToRelConverter.Blackboard bb, org.apache.calcite.util.ImmutableBitSet groupSet, com.google.common.collect.ImmutableList<org.apache.calcite.util.ImmutableBitSet> groupSets, List<org.apache.calcite.rel.core.AggregateCall> aggCalls)
In case the aggregate rel changes the order in which it projects fields, the
groupExprProjection
parameter is provided, and the implementation of this method may
modify it.
The sortedCount
parameter is the number of expressions known to be monotonic.
These expressions must be on the leading edge of the grouping keys. The default
implementation of this method ignores this parameter.
bb
- BlackboardgroupSet
- Bit set of ordinals of grouping columnsgroupSets
- Grouping setsaggCalls
- Array of calls to aggregate functionspublic org.apache.calcite.rex.RexDynamicParam convertDynamicParam(org.apache.calcite.sql.SqlDynamicParam dynamicParam)
protected void gatherOrderExprs(SqlToRelConverter.Blackboard bb, org.apache.calcite.sql.SqlSelect select, org.apache.calcite.sql.SqlNodeList orderList, List<org.apache.calcite.sql.SqlNode> extraOrderExprs, List<org.apache.calcite.rel.RelFieldCollation> collationList)
extraOrderExprs
with any sort expressions which are not in the select
clause.bb
- Scope within which to resolve identifiersselect
- Select clause. Never null, because we invent a dummy SELECT if ORDER BY is
applied to a set operation (UNION etc.)orderList
- Order by clause, may be nullextraOrderExprs
- Sort expressions which are not in the select clause (output)collationList
- List of collations (output)protected org.apache.calcite.rel.RelFieldCollation convertOrderItem(org.apache.calcite.sql.SqlSelect select, org.apache.calcite.sql.SqlNode orderItem, List<org.apache.calcite.sql.SqlNode> extraExprs, org.apache.calcite.rel.RelFieldCollation.Direction direction, org.apache.calcite.rel.RelFieldCollation.NullDirection nullDirection)
@Deprecated protected boolean enableDecorrelation()
protected org.apache.calcite.rel.RelNode decorrelateQuery(org.apache.calcite.rel.RelNode rootRel)
@Deprecated public boolean isTrimUnusedFields()
protected org.apache.calcite.rel.RelRoot convertQueryRecursive(org.apache.calcite.sql.SqlNode query, boolean top, org.apache.calcite.rel.type.RelDataType targetRowType)
query
- Querytop
- Whether this query is the top-level query of the statementtargetRowType
- Target row type, or nullprotected org.apache.calcite.rel.RelNode convertSetOp(org.apache.calcite.sql.SqlCall call)
call
- Call to set operatorprotected org.apache.calcite.rel.RelNode convertInsert(org.apache.calcite.sql.SqlInsert call)
public org.apache.calcite.rel.RelNode toRel(org.apache.calcite.plan.RelOptTable table, @Nonnull List<org.apache.calcite.rel.hint.RelHint> hints)
protected org.apache.calcite.plan.RelOptTable getTargetTable(org.apache.calcite.sql.SqlNode call)
protected org.apache.calcite.rel.RelNode convertColumnList(org.apache.calcite.sql.SqlInsert call, org.apache.calcite.rel.RelNode source)
If the column list is not specified, source expressions match target columns in order.
If the column list is specified, Source expressions are mapped to target columns by name via targetColumnList, and may not cover the entire target table. So, we'll make up a full row, using a combination of default values and the source expressions provided.
call
- Insert expressionsource
- Source relational expressionprotected void collectInsertTargets(org.apache.calcite.sql.SqlInsert call, org.apache.calcite.rex.RexNode sourceRef, List<String> targetColumnNames, List<org.apache.calcite.rex.RexNode> columnExprs)
call
- Insert statementsourceRef
- Expression representing a row from the source relational expressiontargetColumnNames
- List of target column names, to be populatedcolumnExprs
- List of expressions, to be populatedprotected org.apache.calcite.rex.RexNode adjustInputRef(SqlToRelConverter.Blackboard bb, org.apache.calcite.rex.RexInputRef inputRef)
bb
- BlackboardinputRef
- Input refprotected void extraSelectItems(SqlToRelConverter.Blackboard bb, org.apache.calcite.sql.SqlSelect select, List<org.apache.calcite.rex.RexNode> exprList, List<String> nameList, Collection<String> aliasList, List<org.apache.calcite.sql.validate.SqlMonotonicity> columnMonotonicityList)
bb
- Blackboardselect
- Select statement being translatedexprList
- List of expressions in select clausenameList
- List of names, one per columnaliasList
- Collection of aliases that have been used alreadycolumnMonotonicityList
- List of monotonicity, one per columnpublic org.apache.calcite.rel.RelRoot convertWith(org.apache.calcite.sql.SqlWith with, boolean top)
public org.apache.calcite.rel.RelNode convertValues(org.apache.calcite.sql.SqlCall values, org.apache.calcite.rel.type.RelDataType targetRowType)
@Deprecated public static SqlToRelConverter.ConfigBuilder configBuilder()
SqlToRelConverter.Config
.public static SqlToRelConverter.Config config()
SqlToRelConverter.Config
.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.