QueryEngine¶
Creating Instance¶
QueryEngine
takes the following to be created:
- ServiceContext
-
ProcessingLogContext
QueryEngine
is created when:
EngineContext
is requested to create one (whenEngineExecutor
is requested to plan a Query for execution)
Building Logical Plan of Query (buildQueryLogicalPlan)¶
OutputNode buildQueryLogicalPlan(
Query query,
Optional<Sink> sink,
MetaStore metaStore,
KsqlConfig config,
boolean rowpartitionRowoffsetEnabled)
buildQueryLogicalPlan
takes a Query statement and returns an OutputNode.
The optional Sink
can only be defined when EngineExecutor
is requested to plan a statement (which is a QueryContainer).
buildQueryLogicalPlan
creates a QueryAnalyzer with the MetaStore and the values of the following configuration properties (from the given KsqlConfig):
buildQueryLogicalPlan
requests the QueryAnalyzer
to analyze the given query.
In the end, buildQueryLogicalPlan
creates a LogicalPlanner to buildPersistentLogicalPlan.
buildQueryLogicalPlan
is used when:
EngineExecutor
is requested to plan a query
Building Physical Query Plan (buildPhysicalPlan)¶
PhysicalPlan buildPhysicalPlan(
LogicalPlanNode logicalPlanNode,
SessionConfig config,
MetaStore metaStore,
QueryId queryId,
Optional<PlanInfo> oldPlanInfo)
buildPhysicalPlan
creates a StreamsBuilder
(Kafka Streams).
buildPhysicalPlan
creates a PhysicalPlanBuilder (with the StreamsBuilder
) to build a physical plan of the given LogicalPlanNode
(and the given QueryId
and the PlanInfo
of the query to be "replaced").
buildPhysicalPlan
is used when:
EngineExecutor
is requested to plan a query