Skip to content

QueryEngine

Creating Instance

QueryEngine takes the following to be created:

QueryEngine is created when:

Building Query Logical Plan

OutputNode buildQueryLogicalPlan(
  Query query,
  Optional<Sink> sink,
  MetaStore metaStore,
  KsqlConfig config,
  boolean rowpartitionRowoffsetEnabled)

In summary, buildQueryLogicalPlan takes a Query statement and returns an OutputNode.


The optional Sink is only 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:

Building Physical Query Plan

PhysicalPlan buildPhysicalPlan(
  LogicalPlanNode logicalPlanNode,
  SessionConfig config,
  MetaStore metaStore,
  QueryId queryId,
  Optional<PlanInfo> oldPlanInfo)

buildPhysicalPlan creates a StreamsBuilder (Kafka Streams).

buildPhysicalPlan creates a ExecutionPlanBuilder (with the StreamsBuilder).

In the end, buildPhysicalPlan requests the ExecutionPlanBuilder to build an ExecutionPlan for the given LogicalPlanNode (and the given QueryId and the current PlanInfo of the query to be "replaced" if available).


buildPhysicalPlan is used when: