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
Modifier and TypeFieldDescriptionprotected final SqlRexConvertletTable
protected final RelOptPlanner
protected final CalcitePrepareImpl
protected final RexBuilder
protected final CalciteSchema
protected final RelDataTypeFactory
Fields inherited from class org.apache.calcite.prepare.Prepare
catalogReader, context, fieldOrigins, LOGGER, parameterRowType, resultConvention, THREAD_EXPAND, THREAD_INSUBQUERY_THRESHOLD, THREAD_TRIM, timingTracer
-
Constructor Summary
ConstructorDescriptionCalcitePreparingStmt
(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.PreparedResult
createPreparedExplanation
(@Nullable RelDataType resultType, RelDataType parameterRowType, @Nullable RelRoot root, SqlExplainFormat format, SqlExplainLevel detailLevel) protected SqlValidator
createSqlValidator
(Prepare.CatalogReader catalogReader, UnaryOperator<SqlValidator.Config> configTransform) protected RelNode
decorrelate
(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 SqlToRelConverter
getSqlToRelConverter
(SqlValidator validator, Prepare.CatalogReader catalogReader, SqlToRelConverter.Config config) Protected method to allow subclasses to override construction of SqlToRelConverter.protected SqlValidator
protected Prepare.PreparedResult
Implements a physical query plan.protected void
prepareQueryable
(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:Prepare
Protected method to allow subclasses to override construction of SqlToRelConverter.- Specified by:
getSqlToRelConverter
in classPrepare
-
flattenTypes
- Specified by:
flattenTypes
in classPrepare
-
decorrelate
- Specified by:
decorrelate
in classPrepare
-
expandView
public RelRoot expandView(RelDataType rowType, String queryString, List<String> schemaPath, @Nullable List<String> viewPath) Description copied from interface:RelOptTable.ViewExpander
Returns a relational expression that is to be substituted for an access to a SQL view.- Specified by:
expandView
in 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:
getSqlValidator
in classPrepare
-
createPreparedExplanation
protected Prepare.PreparedResult createPreparedExplanation(@Nullable RelDataType resultType, RelDataType parameterRowType, @Nullable RelRoot root, SqlExplainFormat format, SqlExplainLevel detailLevel) - Specified by:
createPreparedExplanation
in classPrepare
-
implement
Description copied from class:Prepare
Implements a physical query plan. -
getMaterializations
- Specified by:
getMaterializations
in classPrepare
-
getLattices
- Specified by:
getLattices
in classPrepare
-