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
Nested ClassesModifier and TypeClassDescriptionstatic classHolds 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
FieldsModifier and TypeFieldDescriptionstatic final booleanDeprecated.static final booleanDeprecated.final booleanWhether 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionanalyzeView(CalcitePrepare.Context context, String sql, boolean fail) Analyzes a view.convert(CalcitePrepare.Context context, String sql) protected RelOptClustercreateCluster(RelOptPlanner planner, RexBuilder rexBuilder) Factory method for cluster.protected SqlRexConvertletTableFactory method for default convertlet table.protected SqlParsercreateParser(String sql) Factory method for default SQL parser.protected SqlParsercreateParser(String sql, SqlParser.Config parserConfig) Factory method for SQL parser with a given configuration.protected SqlParsercreateParser(String sql, SqlParser.ConfigBuilder parserConfig) Deprecated.protected SqlParser.ConfigBuilderDeprecated.protected RelOptPlannercreatePlanner(CalcitePrepare.Context prepareContext) Creates a query planner and initializes it with a default set of rules.protected RelOptPlannercreatePlanner(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.voidexecuteDdl(CalcitePrepare.Context context, SqlNode node) Executes a DDL statement.protected CalcitePrepareImpl.CalcitePreparingStmtgetPreparingStmt(CalcitePrepare.Context context, Type elementType, CalciteCatalogReader catalogReader, RelOptPlanner planner) Returns CalcitePreparingStmtparse(CalcitePrepare.Context context, String sql) protected SqlParser.ConfigFactory method for SQL parser configuration.<R> Rperform(CalciteServerStatement statement, FrameworkConfig config, Frameworks.BasePrepareAction<R> action) Executes a prepare action.<R> Rperform(CalciteServerStatement statement, Frameworks.PrepareAction<R> action) Deprecated.protected voidpopulateMaterializations(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:
parsein interfaceCalcitePrepare
-
convert
- Specified by:
convertin interfaceCalcitePrepare
-
analyzeView
public CalcitePrepare.AnalyzeViewResult analyzeView(CalcitePrepare.Context context, String sql, boolean fail) Description copied from interface:CalcitePrepareAnalyzes a view.- Specified by:
analyzeViewin 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:CalcitePrepareExecutes a DDL statement.The statement identified itself as DDL in the
CalcitePrepare.ParseResult.kind()field.- Specified by:
executeDdlin 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:
prepareQueryablein interfaceCalcitePrepare
-
prepareSql
public <T> CalcitePrepare.CalciteSignature<T> prepareSql(CalcitePrepare.Context context, CalcitePrepare.Query<T> query, Type elementType, long maxRowCount) - Specified by:
prepareSqlin interfaceCalcitePrepare
-
getPreparingStmt
protected CalcitePrepareImpl.CalcitePreparingStmt getPreparingStmt(CalcitePrepare.Context context, Type elementType, CalciteCatalogReader catalogReader, RelOptPlanner planner) Returns CalcitePreparingStmtOverride this function to return a custom
CalcitePrepareImpl.CalcitePreparingStmtandcreateSqlValidator(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.
-