Class CalcitePrepareImpl
- All Implemented Interfaces:
CalcitePrepare
This class is public so that projects that create their own JDBC driver and server can fine-tune preferences. However, this class and its methods are subject to change without notice.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Holds state for the process of preparing a SQL statement.Nested classes/interfaces inherited from interface org.apache.calcite.jdbc.CalcitePrepare
CalcitePrepare.AnalyzeViewResult, CalcitePrepare.CalciteSignature<T>, CalcitePrepare.Context, CalcitePrepare.ConvertResult, CalcitePrepare.Dummy, CalcitePrepare.ParseResult, CalcitePrepare.Query<T>, CalcitePrepare.SparkHandler
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
Deprecated.static final boolean
Deprecated.final boolean
Whether the bindable convention should be the root convention of any plan.static final List<RelOptRule>
Deprecated.Fields inherited from interface org.apache.calcite.jdbc.CalcitePrepare
DEFAULT_FACTORY, THREAD_CONTEXT_STACK
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionanalyzeView
(CalcitePrepare.Context context, String sql, boolean fail) Analyzes a view.convert
(CalcitePrepare.Context context, String sql) protected RelOptCluster
createCluster
(RelOptPlanner planner, RexBuilder rexBuilder) Factory method for cluster.protected SqlRexConvertletTable
Factory method for default convertlet table.protected SqlParser
createParser
(String sql) Factory method for default SQL parser.protected SqlParser
createParser
(String sql, SqlParser.Config parserConfig) Factory method for SQL parser with a given configuration.protected SqlParser
createParser
(String sql, SqlParser.ConfigBuilder parserConfig) Deprecated.protected SqlParser.ConfigBuilder
Deprecated.protected RelOptPlanner
createPlanner
(CalcitePrepare.Context prepareContext) Creates a query planner and initializes it with a default set of rules.protected RelOptPlanner
createPlanner
(CalcitePrepare.Context prepareContext, @Nullable Context externalContext, @Nullable RelOptCostFactory costFactory) Creates a query planner and initializes it with a default set of rules.protected List<Function1<CalcitePrepare.Context,
RelOptPlanner>> Creates a collection of planner factories.void
executeDdl
(CalcitePrepare.Context context, SqlNode node) Executes a DDL statement.protected CalcitePrepareImpl.CalcitePreparingStmt
getPreparingStmt
(CalcitePrepare.Context context, Type elementType, CalciteCatalogReader catalogReader, RelOptPlanner planner) Returns CalcitePreparingStmtparse
(CalcitePrepare.Context context, String sql) protected SqlParser.Config
Factory method for SQL parser configuration.<R> R
perform
(CalciteServerStatement statement, FrameworkConfig config, Frameworks.BasePrepareAction<R> action) Executes a prepare action.<R> R
perform
(CalciteServerStatement statement, Frameworks.PrepareAction<R> action) Deprecated.protected void
populateMaterializations
(CalcitePrepare.Context context, RelOptCluster cluster, Prepare.Materialization materialization) prepareQueryable
(CalcitePrepare.Context context, Queryable<T> queryable) prepareSql
(CalcitePrepare.Context context, CalcitePrepare.Query<T> query, Type elementType, long maxRowCount)
-
Field Details
-
ENABLE_ENUMERABLE
Deprecated. -
ENABLE_STREAM
Deprecated. -
ENUMERABLE_RULES
Deprecated. -
enableBindable
public final boolean enableBindableWhether the bindable convention should be the root convention of any plan. If not, enumerable convention is the default.
-
-
Constructor Details
-
CalcitePrepareImpl
public CalcitePrepareImpl()
-
-
Method Details
-
parse
- Specified by:
parse
in interfaceCalcitePrepare
-
convert
- Specified by:
convert
in interfaceCalcitePrepare
-
analyzeView
public CalcitePrepare.AnalyzeViewResult analyzeView(CalcitePrepare.Context context, String sql, boolean fail) Description copied from interface:CalcitePrepare
Analyzes a view.- Specified by:
analyzeView
in interfaceCalcitePrepare
- Parameters:
context
- Contextsql
- View SQLfail
- Whether to fail (and throw a descriptive error message) if the view is not modifiable- Returns:
- Result of analyzing the view
-
executeDdl
Description copied from interface:CalcitePrepare
Executes a DDL statement.The statement identified itself as DDL in the
CalcitePrepare.ParseResult.kind()
field.- Specified by:
executeDdl
in interfaceCalcitePrepare
-
createParser
Factory method for default SQL parser. -
createParser
Factory method for SQL parser with a given configuration. -
createParser
Deprecated. -
parserConfig
Factory method for SQL parser configuration. -
createParserConfig
Deprecated. -
createConvertletTable
Factory method for default convertlet table. -
createCluster
Factory method for cluster. -
createPlannerFactories
Creates a collection of planner factories.The collection must have at least one factory, and each factory must create a planner. If the collection has more than one planner, Calcite will try each planner in turn.
One of the things you can do with this mechanism is to try a simpler, faster, planner with a smaller rule set first, then fall back to a more complex planner for complex and costly queries.
The default implementation returns a factory that calls
createPlanner(org.apache.calcite.jdbc.CalcitePrepare.Context)
. -
createPlanner
Creates a query planner and initializes it with a default set of rules. -
createPlanner
protected RelOptPlanner createPlanner(CalcitePrepare.Context prepareContext, @Nullable Context externalContext, @Nullable RelOptCostFactory costFactory) Creates a query planner and initializes it with a default set of rules. -
prepareQueryable
public <T> CalcitePrepare.CalciteSignature<T> prepareQueryable(CalcitePrepare.Context context, Queryable<T> queryable) - Specified by:
prepareQueryable
in interfaceCalcitePrepare
-
prepareSql
public <T> CalcitePrepare.CalciteSignature<T> prepareSql(CalcitePrepare.Context context, CalcitePrepare.Query<T> query, Type elementType, long maxRowCount) - Specified by:
prepareSql
in interfaceCalcitePrepare
-
getPreparingStmt
protected CalcitePrepareImpl.CalcitePreparingStmt getPreparingStmt(CalcitePrepare.Context context, Type elementType, CalciteCatalogReader catalogReader, RelOptPlanner planner) Returns CalcitePreparingStmtOverride this function to return a custom
CalcitePrepareImpl.CalcitePreparingStmt
andcreateSqlValidator(org.apache.calcite.jdbc.CalcitePrepare.Context, org.apache.calcite.prepare.CalciteCatalogReader, java.util.function.UnaryOperator<org.apache.calcite.sql.validate.SqlValidator.Config>)
to enable custom validation logic. -
populateMaterializations
protected void populateMaterializations(CalcitePrepare.Context context, RelOptCluster cluster, Prepare.Materialization materialization) -
perform
@Deprecated public <R> R perform(CalciteServerStatement statement, Frameworks.PrepareAction<R> action) Deprecated. -
perform
public <R> R perform(CalciteServerStatement statement, FrameworkConfig config, Frameworks.BasePrepareAction<R> action) Executes a prepare action.
-