Skip to content

KsqlExecutionContext

KsqlExecutionContext is an abstraction of execution contexts.

Contract (Subset)

Creating Sandboxed Execution Context (createSandbox)

KsqlExecutionContext createSandbox(
  ServiceContext serviceContext)

Used when:

  • KsqlContext is requested to execute a SQL text
  • DefaultSchemaInjector is requested to forCreateAsStatement
  • SchemaRegisterInjector is requested to registerForCreateAs
  • StandaloneExecutor is requested to validateStatements
  • DistributingExecutor is requested to execute
  • ExplainExecutor is requested to explainStatement
  • KsqlResource is requested to configure

Statement Execution (execute)

ExecuteResult execute(
  ServiceContext serviceContext,
  ConfiguredKsqlPlan plan)
ExecuteResult execute(
  ServiceContext serviceContext,
  ConfiguredStatement<?> statement)

Executes a KsqlPlan or a Statement

Used when:

Executing Scalable Push Query

ScalablePushQueryMetadata executeScalablePushQuery(
  ImmutableAnalysis analysis,
  ServiceContext serviceContext,
  ConfiguredStatement<Query> statement,
  PushRouting pushRouting,
  PushRoutingOptions pushRoutingOptions,
  QueryPlannerOptions queryPlannerOptions,
  Context context,
  Optional<ScalablePushQueryMetrics> scalablePushQueryMetrics)

Used when:

Executing Table Pull Query

PullQueryResult executeTablePullQuery(
  ImmutableAnalysis analysis,
  ServiceContext serviceContext,
  ConfiguredStatement<Query> statement,
  HARouting routing,
  RoutingOptions routingOptions,
  QueryPlannerOptions queryPlannerOptions,
  Optional<PullQueryExecutorMetrics> pullQueryMetrics,
  boolean startImmediately,
  Optional<ConsistencyOffsetVector> consistencyOffsetVector)

Used when:

Executing Transient Query

TransientQueryMetadata executeTransientQuery(
  ServiceContext serviceContext,
  ConfiguredStatement<Query> statement,
  boolean excludeTombstones)

Used when:

getAllLiveQueries

List<QueryMetadata> getAllLiveQueries()

Used when:

  • ListQueriesExecutor is requested to getLocalSimple, getLocalExtended
  • QueryCapacityUtil utility is used to getNumLivePushQueries

getPersistentQueries

List<PersistentQueryMetadata> getPersistentQueries()

Used when:

  • KsqlContext is requested to getPersistentQueries
  • KsqlEngineMetrics is requested to configureNumPersistentQueries and configureGaugeForState
  • PersistentQuerySaturationMetrics is requested to run
  • DiscoverClusterService is requested to runOneIteration
  • SendLagService is requested to runOneIteration
  • StandaloneExecutor is requested to processesQueryFile
  • CommandRunner is requested to processPriorCommands
  • others

Parsing SQL Text

List<ParsedStatement> parse(
  String sql)

Used when:

Statement Planning (plan)

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

Used when:

Preparing Statement for Execution

PreparedStatement<?> prepare(
  ParsedStatement stmt,
  Map<String, String> variablesMap)
PreparedStatement<?> prepare(
  ParsedStatement stmt) // (1)!
  1. Uses an empty Map

Used when:

  • KsqlContext is requested to execute
  • KsqlRestApplication is requested to registerCommandTopic
  • QueryEndpoint is requested to createStatement
  • RequestHandler is requested to execute
  • RequestValidator is requested to validate
  • SqlFormatInjector is requested to inject
  • StandaloneExecutor.StatementExecutor is requested to prepare a statement
  • StatementParser is requested to parseSingleStatement

Implementations

Back to top