Skip to content


SandboxedExecutionContext is a KsqlExecutionContext for executing SQL statements without affecting the state of the system (i.e. no changes to the core engine's state nor the state of external services).

Creating Instance

SandboxedExecutionContext takes the following to be created:

SandboxedExecutionContext is created when:

SandboxedExecutionContext is a KsqlExecutionContext and part of the abstraction is to create a SandboxedExecutionContext. This is exactly SandboxedExecutionContext itself by default.

That's why instances of SandboxedExecutionContexts are created indirectly via KsqlExecutionContext.


While being created, SandboxedExecutionContext requests the given source EngineContext to create a sandboxed EngineContext.

Statement Planning (plan)

KsqlPlan plan(
  ServiceContext serviceContext,
  ConfiguredStatement<?> statement)

plan is part of the KsqlExecutionContext abstraction.

plan creates an EngineExecutor to plan the given ConfiguredStatement.

Executing Statement

ExecuteResult execute(
  ServiceContext serviceContext,
  ConfiguredStatement<?> statement) // (1)!
ExecuteResult execute(
  ServiceContext serviceContext,
  ConfiguredKsqlPlan plan)
  1. Plans the statement and creates a ConfiguredKsqlPlan for the other execute

execute creates an EngineExecutor to execute the KsqlPlan (of the ConfiguredKsqlPlan) and produce an ExecuteResult.

execute requests the ExecuteResult for the QueryMetadata and get the KafkaStreams client that is closed right after.

In the end, execute returns the ExecuteResult.

execute is part of the KsqlExecutionContext abstraction.

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.