Class CalcitePlanner
java.lang.Object
org.apache.druid.sql.calcite.planner.CalcitePlanner
- All Implemented Interfaces:
AutoCloseable,org.apache.calcite.plan.RelOptTable.ViewExpander,org.apache.calcite.tools.Planner
public class CalcitePlanner
extends Object
implements org.apache.calcite.tools.Planner, org.apache.calcite.plan.RelOptTable.ViewExpander
Calcite planner. Clone of Calcite's
PlannerImpl, as of version 1.35,
but with the validator made accessible, and with the minimum of formatting
changes needed to pass Druid's static checks. Note that the resulting code
is more Calcite-like than Druid-like. There seemed no value in restructuring
the code just to be more Druid-like.
Changes in 1.35:
Allowing user-defined config and appending default values to the config
frameworkConfig is now replaced by costFactory-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCalcitePlanner(org.apache.calcite.tools.FrameworkConfig config) Creates a planner. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()final org.apache.calcite.rel.RelNodeconvert(org.apache.calcite.sql.SqlNode sql) org.apache.calcite.rel.RelRootexpandView(org.apache.calcite.rel.type.RelDataType rowType, String queryString, List<String> schemaPath, List<String> viewPath) org.apache.calcite.plan.RelTraitSetorg.apache.calcite.rel.type.RelDataTypeorg.apache.calcite.adapter.java.JavaTypeFactoryorg.apache.calcite.sql.validate.SqlValidatororg.apache.calcite.sql.SqlNodeorg.apache.calcite.rel.RelRootrel(org.apache.calcite.sql.SqlNode sql) voidreset()voidSkip parsing, moving state along to aCalcitePlanner.State.STATE_3_PARSED.org.apache.calcite.rel.RelNodetransform(int ruleSetIndex, org.apache.calcite.plan.RelTraitSet requiredOutputTraits, org.apache.calcite.rel.RelNode rel) org.apache.calcite.sql.SqlNodevalidate(org.apache.calcite.sql.SqlNode sqlNode) org.apache.calcite.util.Pair<org.apache.calcite.sql.SqlNode,org.apache.calcite.rel.type.RelDataType> validateAndGetType(org.apache.calcite.sql.SqlNode sqlNode) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.calcite.tools.Planner
parse
-
Constructor Details
-
CalcitePlanner
public CalcitePlanner(org.apache.calcite.tools.FrameworkConfig config) Creates a planner. Not a public API; callFrameworks.getPlanner(org.apache.calcite.tools.FrameworkConfig)instead.
-
-
Method Details
-
getEmptyTraitSet
public org.apache.calcite.plan.RelTraitSet getEmptyTraitSet()- Specified by:
getEmptyTraitSetin interfaceorg.apache.calcite.tools.Planner
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceorg.apache.calcite.tools.Planner
-
reset
public void reset()- Specified by:
resetin interfaceorg.apache.calcite.tools.Planner
-
parse
public org.apache.calcite.sql.SqlNode parse(Reader reader) throws org.apache.calcite.sql.parser.SqlParseException - Specified by:
parsein interfaceorg.apache.calcite.tools.Planner- Throws:
org.apache.calcite.sql.parser.SqlParseException
-
skipParse
public void skipParse()Skip parsing, moving state along to aCalcitePlanner.State.STATE_3_PARSED. We have this because we parse before the planner is even created, usingDruidSqlParser, in order to capture SET statements as early as possible. -
validate
public org.apache.calcite.sql.SqlNode validate(org.apache.calcite.sql.SqlNode sqlNode) throws org.apache.calcite.tools.ValidationException - Specified by:
validatein interfaceorg.apache.calcite.tools.Planner- Throws:
org.apache.calcite.tools.ValidationException
-
getValidator
public org.apache.calcite.sql.validate.SqlValidator getValidator() -
validateAndGetType
public org.apache.calcite.util.Pair<org.apache.calcite.sql.SqlNode,org.apache.calcite.rel.type.RelDataType> validateAndGetType(org.apache.calcite.sql.SqlNode sqlNode) throws org.apache.calcite.tools.ValidationException - Specified by:
validateAndGetTypein interfaceorg.apache.calcite.tools.Planner- Throws:
org.apache.calcite.tools.ValidationException
-
getParameterRowType
public org.apache.calcite.rel.type.RelDataType getParameterRowType()- Specified by:
getParameterRowTypein interfaceorg.apache.calcite.tools.Planner
-
convert
public final org.apache.calcite.rel.RelNode convert(org.apache.calcite.sql.SqlNode sql) - Specified by:
convertin interfaceorg.apache.calcite.tools.Planner
-
rel
public org.apache.calcite.rel.RelRoot rel(org.apache.calcite.sql.SqlNode sql) - Specified by:
relin interfaceorg.apache.calcite.tools.Planner
-
expandView
public org.apache.calcite.rel.RelRoot expandView(org.apache.calcite.rel.type.RelDataType rowType, String queryString, List<String> schemaPath, @Nullable List<String> viewPath) - Specified by:
expandViewin interfaceorg.apache.calcite.plan.RelOptTable.ViewExpander
-
getTypeFactory
public org.apache.calcite.adapter.java.JavaTypeFactory getTypeFactory()- Specified by:
getTypeFactoryin interfaceorg.apache.calcite.tools.Planner
-
transform
public org.apache.calcite.rel.RelNode transform(int ruleSetIndex, org.apache.calcite.plan.RelTraitSet requiredOutputTraits, org.apache.calcite.rel.RelNode rel) - Specified by:
transformin interfaceorg.apache.calcite.tools.Planner
-
CalcitePlannerimplementsRelOptTable.ViewExpanderdirectly.