Package org.apache.calcite.prepare
Class CalcitePrepareImpl.CalcitePreparingStmt
java.lang.Object
org.apache.calcite.prepare.Prepare
org.apache.calcite.prepare.CalcitePrepareImpl.CalcitePreparingStmt
- All Implemented Interfaces:
RelOptTable.ViewExpander
- Enclosing class:
CalcitePrepareImpl
public static class CalcitePrepareImpl.CalcitePreparingStmt
extends Prepare
implements RelOptTable.ViewExpander
Holds state for the process of preparing a SQL statement.
Overload this class and createSqlValidator(org.apache.calcite.prepare.Prepare.CatalogReader, java.util.function.UnaryOperator<org.apache.calcite.sql.validate.SqlValidator.Config>) to provide desired
SqlValidator and custom validation logic.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.calcite.prepare.Prepare
Prepare.AbstractPreparingTable, Prepare.CatalogReader, Prepare.Materialization, Prepare.PreparedExplain, Prepare.PreparedResult, Prepare.PreparedResultImpl, Prepare.PreparingTable -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SqlRexConvertletTableprotected final RelOptPlannerprotected final CalcitePrepareImplprotected final RexBuilderprotected final CalciteSchemaprotected final RelDataTypeFactoryFields inherited from class org.apache.calcite.prepare.Prepare
catalogReader, context, fieldOrigins, LOGGER, parameterRowType, resultConvention, THREAD_EXPAND, THREAD_INSUBQUERY_THRESHOLD, THREAD_TRIM, timingTracer -
Constructor Summary
ConstructorsConstructorDescriptionCalcitePreparingStmt(CalcitePrepareImpl prepare, CalcitePrepare.Context context, Prepare.CatalogReader catalogReader, RelDataTypeFactory typeFactory, CalciteSchema schema, @Nullable EnumerableRel.Prefer prefer, RelOptCluster cluster, Convention resultConvention, SqlRexConvertletTable convertletTable) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected Prepare.PreparedResultcreatePreparedExplanation(@Nullable RelDataType resultType, RelDataType parameterRowType, @Nullable RelRoot root, SqlExplainFormat format, SqlExplainLevel detailLevel) protected SqlValidatorcreateSqlValidator(Prepare.CatalogReader catalogReader, UnaryOperator<SqlValidator.Config> configTransform) protected RelNodedecorrelate(SqlToRelConverter sqlToRelConverter, SqlNode query, RelNode rootRel) expandView(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.flattenTypes(RelNode rootRel, boolean restructure) protected List<CalciteSchema.LatticeEntry>protected List<Prepare.Materialization>protected SqlToRelConvertergetSqlToRelConverter(SqlValidator validator, Prepare.CatalogReader catalogReader, SqlToRelConverter.Config config) Protected method to allow subclasses to override construction of SqlToRelConverter.protected SqlValidatorprotected Prepare.PreparedResultImplements a physical query plan.protected voidprepareQueryable(Queryable queryable, RelDataType resultType) prepareRel(RelNode rel) Methods inherited from class org.apache.calcite.prepare.Prepare
getDesiredRootTraitSet, getProgram, mapTableModOp, optimize, prepareSql, prepareSql, trimUnusedFields
-
Field Details
-
planner
-
rexBuilder
-
prepare
-
schema
-
typeFactory
-
convertletTable
-
-
Constructor Details
-
CalcitePreparingStmt
public CalcitePreparingStmt(CalcitePrepareImpl prepare, CalcitePrepare.Context context, Prepare.CatalogReader catalogReader, RelDataTypeFactory typeFactory, CalciteSchema schema, @Nullable EnumerableRel.Prefer prefer, RelOptCluster cluster, Convention resultConvention, SqlRexConvertletTable convertletTable) Constructor.Overload this constructor and
createSqlValidator(org.apache.calcite.prepare.Prepare.CatalogReader, java.util.function.UnaryOperator<org.apache.calcite.sql.validate.SqlValidator.Config>)to provide desired SqlValidator and custom validation logic.
-
-
Method Details
-
init
-
prepareQueryable
-
prepareRel
-
getSqlToRelConverter
protected SqlToRelConverter getSqlToRelConverter(SqlValidator validator, Prepare.CatalogReader catalogReader, SqlToRelConverter.Config config) Description copied from class:PrepareProtected method to allow subclasses to override construction of SqlToRelConverter.- Specified by:
getSqlToRelConverterin classPrepare
-
flattenTypes
- Specified by:
flattenTypesin classPrepare
-
decorrelate
- Specified by:
decorrelatein classPrepare
-
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
-
createSqlValidator
protected SqlValidator createSqlValidator(Prepare.CatalogReader catalogReader, UnaryOperator<SqlValidator.Config> configTransform) -
getSqlValidator
- Specified by:
getSqlValidatorin classPrepare
-
createPreparedExplanation
protected Prepare.PreparedResult createPreparedExplanation(@Nullable RelDataType resultType, RelDataType parameterRowType, @Nullable RelRoot root, SqlExplainFormat format, SqlExplainLevel detailLevel) - Specified by:
createPreparedExplanationin classPrepare
-
implement
Description copied from class:PrepareImplements a physical query plan. -
getMaterializations
- Specified by:
getMaterializationsin classPrepare
-
getLattices
- Specified by:
getLatticesin classPrepare
-