Package org.apache.calcite.prepare
Class PlannerImpl
java.lang.Object
org.apache.calcite.prepare.PlannerImpl
- All Implemented Interfaces:
AutoCloseable,RelOptTable.ViewExpander,Planner
Implementation of
Planner.-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Releases all internal resources utilized while thisPlannerexists.final RelNodeexpandView(RelDataType rowType, String queryString, List<String> schemaPath, @Nullable List<String> viewPath) Returns a relational expression that is to be substituted for an access to a SQL view.Returns a record type that contains the name and type of each parameter.Returns the type factory.Parses and validates a SQL statement.Converts a SQL parse tree into a tree of relational expressions.voidreset()Resets thisPlannerto be used with a new query.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.Validates a SQL statement.validateAndGetType(SqlNode sqlNode) Validates a SQL statement.
-
Constructor Details
-
PlannerImpl
Creates a planner. Not a public API; callFrameworks.getPlanner(org.apache.calcite.tools.FrameworkConfig)instead.
-
-
Method Details
-
getEmptyTraitSet
- Specified by:
getEmptyTraitSetin interfacePlanner
-
close
public void close()Description copied from interface:PlannerReleases all internal resources utilized while thisPlannerexists. Once called, this Planner object is no longer valid.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacePlanner
-
reset
public void reset()Description copied from interface:PlannerResets thisPlannerto be used with a new query. This should be called between each new query. -
parse
Description copied from interface:PlannerParses and validates a SQL statement.- Specified by:
parsein interfacePlanner- Parameters:
reader- A reader which will provide the SQL statement to parse.- Returns:
- The root node of the SQL parse tree.
- Throws:
SqlParseException- on parse error
-
validate
Description copied from interface:PlannerValidates a SQL statement.- Specified by:
validatein interfacePlanner- Parameters:
sqlNode- Root node of the SQL parse tree.- Returns:
- Validated node
- Throws:
ValidationException- if not valid
-
validateAndGetType
Description copied from interface:PlannerValidates a SQL statement.- Specified by:
validateAndGetTypein interfacePlanner- Parameters:
sqlNode- Root node of the SQL parse tree.- Returns:
- Validated node and its validated type.
- Throws:
ValidationException- if not valid
-
getParameterRowType
Description copied from interface:PlannerReturns a record type that contains the name and type of each parameter. Returns a record type with no fields if there are no parameters.- Specified by:
getParameterRowTypein interfacePlanner- Returns:
- Record type
-
convert
-
rel
Description copied from interface:PlannerConverts a SQL parse tree into a tree of relational expressions.You must call
Planner.validate(org.apache.calcite.sql.SqlNode)first. -
expandView
public RelRoot expandView(RelDataType rowType, String queryString, List<String> schemaPath, @Nullable List<String> viewPath) Description copied from interface:RelOptTable.ViewExpanderReturns a relational expression that is to be substituted for an access to a SQL view.- Specified by:
expandViewin interfaceRelOptTable.ViewExpander- Parameters:
rowType- Row type of the viewqueryString- Body of the viewschemaPath- Path of a schema wherein to find referenced tablesviewPath- Path of the view, ending with its name; may be null- Returns:
- Relational expression
-
getTypeFactory
Description copied from interface:PlannerReturns the type factory.- Specified by:
getTypeFactoryin interfacePlanner
-
transform
Description copied from interface:PlannerConverts one relational expression tree into another relational expression based on a particular rule set and requires set of traits.- Specified by:
transformin interfacePlanner- Parameters:
ruleSetIndex- 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.- Returns:
- The root of the new RelNode tree.
-
PlannerImplimplementsRelOptTable.ViewExpanderdirectly.