public class PlannerImpl extends Object implements Planner
Planner.| Modifier and Type | Class and Description |
|---|---|
private static class |
PlannerImpl.State
Stage of a statement in the query-preparation lifecycle.
|
class |
PlannerImpl.ViewExpanderImpl
Implements
RelOptTable.ViewExpander
interface for Planner. |
| Modifier and Type | Field and Description |
|---|---|
private FrameworkConfig |
config |
private SqlRexConvertletTable |
convertletTable |
private SchemaPlus |
defaultSchema |
private RexExecutor |
executor |
private boolean |
open |
private SqlOperatorTable |
operatorTable |
private SqlParser.Config |
parserConfig |
private RelOptPlanner |
planner |
private com.google.common.collect.ImmutableList<Program> |
programs |
private RelRoot |
root |
private SqlToRelConverter.Config |
sqlToRelConverterConfig |
private PlannerImpl.State |
state |
private com.google.common.collect.ImmutableList<RelTraitDef> |
traitDefs
Holds the trait definitions to be registered with planner.
|
private JavaTypeFactory |
typeFactory |
private SqlNode |
validatedSqlNode |
private CalciteSqlValidator |
validator |
| Constructor and Description |
|---|
PlannerImpl(FrameworkConfig config)
Creates a planner.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Releases all internal resources utilized while this
Planner
exists. |
private SqlConformance |
conformance() |
RelNode |
convert(SqlNode sql) |
private CalciteCatalogReader |
createCatalogReader() |
private RexBuilder |
createRexBuilder() |
private void |
ensure(PlannerImpl.State state)
Makes sure that the state is at least the given state.
|
RelTraitSet |
getEmptyTraitSet() |
JavaTypeFactory |
getTypeFactory()
Returns the type factory.
|
SqlNode |
parse(String sql)
Parses and validates a SQL statement.
|
private void |
ready() |
RelRoot |
rel(SqlNode sql)
Converts a SQL parse tree into a tree of relational expressions.
|
void |
reset()
Resets this
Planner to be used with a new query. |
private static SchemaPlus |
rootSchema(SchemaPlus schema) |
RelNode |
transform(int ruleSetIndex,
RelTraitSet requiredOutputTraits,
RelNode rel)
Converts one relational expression tree into another relational expression
based on a particular rule set and requires set of traits.
|
SqlNode |
validate(SqlNode sqlNode)
Validates a SQL statement.
|
Pair<SqlNode,RelDataType> |
validateAndGetType(SqlNode sqlNode)
Validates a SQL statement.
|
private final SqlOperatorTable operatorTable
private final com.google.common.collect.ImmutableList<Program> programs
private final FrameworkConfig config
private final com.google.common.collect.ImmutableList<RelTraitDef> traitDefs
private final SqlParser.Config parserConfig
private final SqlToRelConverter.Config sqlToRelConverterConfig
private final SqlRexConvertletTable convertletTable
private PlannerImpl.State state
private boolean open
private SchemaPlus defaultSchema
private JavaTypeFactory typeFactory
private RelOptPlanner planner
private RexExecutor executor
private CalciteSqlValidator validator
private SqlNode validatedSqlNode
private RelRoot root
public PlannerImpl(FrameworkConfig config)
Frameworks.getPlanner(org.apache.calcite.tools.FrameworkConfig) instead.private void ensure(PlannerImpl.State state)
public RelTraitSet getEmptyTraitSet()
getEmptyTraitSet in interface Plannerpublic void close()
PlannerPlanner
exists. Once called, this Planner object is no longer valid.close in interface AutoCloseableclose in interface Plannerpublic void reset()
PlannerPlanner to be used with a new query. This
should be called between each new query.private void ready()
public SqlNode parse(String sql) throws SqlParseException
Plannerparse in interface Plannersql - The SQL statement to parse.SqlParseException - on parse errorpublic SqlNode validate(SqlNode sqlNode) throws ValidationException
Plannervalidate in interface PlannersqlNode - Root node of the SQL parse tree.ValidationException - if not validprivate SqlConformance conformance()
public Pair<SqlNode,RelDataType> validateAndGetType(SqlNode sqlNode) throws ValidationException
PlannervalidateAndGetType in interface PlannersqlNode - Root node of the SQL parse tree.ValidationException - if not validpublic final RelNode convert(SqlNode sql) throws RelConversionException
convert in interface PlannerRelConversionExceptionpublic RelRoot rel(SqlNode sql) throws RelConversionException
PlannerYou must call Planner.validate(org.apache.calcite.sql.SqlNode) first.
rel in interface Plannersql - The root node of the SQL parse tree.RelConversionException - if the node
cannot be converted or has not been validatedprivate CalciteCatalogReader createCatalogReader()
private static SchemaPlus rootSchema(SchemaPlus schema)
private RexBuilder createRexBuilder()
public JavaTypeFactory getTypeFactory()
PlannergetTypeFactory in interface Plannerpublic RelNode transform(int ruleSetIndex, RelTraitSet requiredOutputTraits, RelNode rel) throws RelConversionException
Plannertransform in interface PlannerruleSetIndex - The RuleSet to use for conversion purposes. Note that
this is zero-indexed and is based on the list and order
of RuleSets provided in the construction of this
Planner.requiredOutputTraits - The set of RelTraits required of the root node
at the termination of the planning cycle.rel - The root of the RelNode tree to convert.RelConversionException - on conversion
errorCopyright © 2012–2018 The Apache Software Foundation. All rights reserved.