Skip to content

EngineContext

Creating Instance

EngineContext takes the following to be created:

EngineContext is created using create and createSandbox factories.

Creating QueryEngine

QueryEngine createQueryEngine(
  ServiceContext serviceContext)

createQueryEngine creates a QueryEngine (with the given ServiceContext and the ProcessingLogContext).


createQueryEngine is simply a convenient factory method that does nothing but new QueryEngine and that little programming trick makes for a more readable fluent client code.

EngineContext
  .createQueryEngine(...)
  .buildPhysicalPlan(...)

createQueryEngine is used when:

CommandFactories

EngineContext creates a CommandFactories when created.

The CommandFactories is used to create a DdlCommand.

Parsing SQL Statements

List<ParsedStatement> parse(
  String sql)

parse requests the KsqlParser to parse the given SQL statements.

parse is used when:

Preparing Statement for Execution

PreparedStatement<?> prepare(
  ParsedStatement stmt,
  Map<String, String> variablesMap)

prepare substitutes variables (in the given ParsedStatement with the variablesMap) and then requests the KsqlParser to prepare the ParsedStatement (with the variables resolved).

prepare sanitizes the statement based on the following configuration properties (in the KsqlConfig):

In the end, prepare creates a new PreparedStatement.


prepare is used when:

Variable Substitution

ParsedStatement substituteVariables(
  ParsedStatement stmt,
  Map<String, String> variablesMap)

substituteVariables substitutes variables (in the given ParsedStatement with the variablesMap) and then parses the SQL text.

Creating EngineContext

EngineContext create(
  ServiceContext serviceContext,
  ProcessingLogContext processingLogContext,
  MutableMetaStore metaStore,
  QueryIdGenerator queryIdGenerator,
  QueryCleanupService cleanupService,
  KsqlConfig ksqlConfig,
  Collection<QueryEventListener> registrationListeners)

create creates a EngineContext (with a new DefaultKsqlParser, a new QueryRegistryImpl and the others).

create is used when:

Creating Sandboxed EngineContext

EngineContext createSandbox(
  ServiceContext serviceContext)

createSandbox creates an EngineContext.

createSandbox is used when:

  • SandboxedExecutionContext is created

Creating DdlCommand

DdlCommand createDdlCommand(
  KsqlStructuredDataOutputNode outputNode)
DdlCommand createDdlCommand(
  String sqlExpression,
  ExecutableDdlStatement statement,
  SessionConfig config)

createDdlCommand requests the CommandFactories to create a DdlCommand.

createDdlCommand is used when:

Back to top