KsqlEngine¶
KsqlEngine
is a facade of EngineContext.
Creating Instance¶
KsqlEngine
takes the following to be created:
- ServiceContext
- ProcessingLogContext
- Service ID
- MutableMetaStore
-
Function<KsqlEngine, KsqlEngineMetrics>
- QueryIdGenerator
- KsqlConfig
-
QueryEventListener
s
KsqlEngine
is created when:
KsqlContext
is requested to createKsqlRestApplication
is requested to buildApplicationStandaloneExecutorFactory
is requested to create
EngineContext¶
KsqlEngine
creates an EngineContext when created.
KsqlEngine
is (pretty much) a facade of the EngineContext
.
Executing Statement¶
ExecuteResult execute(
ServiceContext serviceContext,
ConfiguredStatement<?> statement) // (1)!
ExecuteResult execute(
ServiceContext serviceContext,
ConfiguredKsqlPlan plan)
- Plans the statement and creates a
ConfiguredKsqlPlan
for the otherexecute
execute
creates an EngineExecutor to execute the KsqlPlan (of the given ConfiguredKsqlPlan
).
execute
is part of the KsqlExecutionContext abstraction.
Statement Planning (plan)¶
KsqlPlan plan(
ServiceContext serviceContext,
ConfiguredStatement<?> statement)
plan
creates an EngineExecutor to plan the given ConfiguredStatement
.
plan
is part of the KsqlExecutionContext abstraction.
getAllLiveQueries¶
List<QueryMetadata> getAllLiveQueries()
getAllLiveQueries
...FIXME
getAllLiveQueries
is part of the KsqlExecutionContext abstraction.
Parsing SQL Statements¶
List<ParsedStatement> parse(
String sql)
parse
requests the EngineContext to parse the given SQL statements (into a collection of ParsedStatement
s).
parse
is part of the KsqlExecutionContext abstraction.
Preparing Statement for Execution¶
PreparedStatement<?> prepare(
ParsedStatement stmt,
Map<String, String> variablesMap)
prepare
requests the EngineContext to prepare the given ParsedStatement.
prepare
is part of the KsqlExecutionContext abstraction.
Executing Scalable Push Query¶
ScalablePushQueryMetadata executeScalablePushQuery(
ImmutableAnalysis analysis,
ServiceContext serviceContext,
ConfiguredStatement<Query> statement,
PushRouting pushRouting,
PushRoutingOptions pushRoutingOptions,
QueryPlannerOptions queryPlannerOptions,
Context context,
Optional<ScalablePushQueryMetrics> scalablePushQueryMetrics)
executeScalablePushQuery
creates an EngineExecutor to execute a scalable push query.
executeScalablePushQuery
is part of the KsqlExecutionContext abstraction.
Executing Table Pull Query¶
PullQueryResult executeTablePullQuery(
ImmutableAnalysis analysis,
ServiceContext serviceContext,
ConfiguredStatement<Query> statement,
HARouting routing,
RoutingOptions routingOptions,
QueryPlannerOptions plannerOptions,
Optional<PullQueryExecutorMetrics> pullQueryMetrics,
boolean startImmediately,
Optional<ConsistencyOffsetVector> consistencyOffsetVector)
executeTablePullQuery
...FIXME
executeTablePullQuery
is part of the KsqlExecutionContext abstraction.
isExecutableStatement¶
boolean isExecutableStatement(
Statement statement)
isExecutableStatement
is positive (true
) when the given Statement is one of the following:
isExecutableStatement
is used when:
EngineExecutor
is requested to throwOnNonExecutableStatementRequestValidator
is requested to validate
analyzeQueryWithNoOutputTopic¶
ImmutableAnalysis analyzeQueryWithNoOutputTopic(
Query query,
String queryText,
Map<String, Object> configOverrides)
analyzeQueryWithNoOutputTopic
...FIXME
analyzeQueryWithNoOutputTopic
is used when:
QueryExecutor
is requested to handle pull or push queries
Executing Transient Query¶
TransientQueryMetadata executeTransientQuery(
ServiceContext serviceContext,
ConfiguredStatement<Query> statement,
boolean excludeTombstones)
executeTransientQuery
creates an EngineExecutor to executeTransientQuery.
executeTransientQuery
is part of the KsqlExecutionContext abstraction.
Creating Stream Pull Query¶
StreamPullQueryMetadata createStreamPullQuery(
ServiceContext serviceContext,
ImmutableAnalysis analysis,
ConfiguredStatement<Query> statementOrig,
boolean excludeTombstones)
createStreamPullQuery
...FIXME
createStreamPullQuery
is used when:
QueryExecutor
is requested to handle a stream pull query