Skip to content

CommandFactories

CommandFactories is a DdlCommandFactory.

Creating Instance

CommandFactories takes the following to be created:

CommandFactories is created alongside an EngineContext

Command Factories

CommandFactories creates FACTORIES collection of handlers (functions) for DdlStatements to produce DdlCommands.

DdlStatement Handler
CreateStream handleCreateStream
CreateTable handleCreateTable
DropStream handleDropStream
DropTable handleDropTable
RegisterType handleRegisterType
DropType handleDropType
AlterSource handleAlterSource

The FACTORIES is used in create.

Creating DdlCommand

create is part of the DdlCommandFactory abstraction.

DdlStatement

DdlCommand create(
  String sqlExpression,
  DdlStatement ddlStatement,
  SessionConfig config)

create looks up (the class of) the given DdlStatement in the FACTORIES registry to handle it (and produce a DdlCommand).

Unless found, create throws a KsqlException:

Unable to find ddl command factory for statement: [class] valid statements:[FACTORIES]

KsqlStructuredDataOutputNode

DdlCommand create(
  KsqlStructuredDataOutputNode outputNode)

For a KSTREAM node output type (of the given KsqlStructuredDataOutputNode), create requests the CreateSourceFactory for a CreateStreamCommand.

Otherwise, create requests the CreateSourceFactory for a CreateTableCommand.

handleCreateStream

CreateStreamCommand handleCreateStream(
  CallInfo callInfo,
  CreateStream statement)

handleCreateStream requests the CreateSourceFactory for a CreateStreamCommand (for the given CreateStream statement).

handleCreateTable

CreateTableCommand handleCreateTable(
  CallInfo callInfo,
  CreateTable statement)

handleCreateTable requests the CreateSourceFactory for a CreateTableCommand (for the given CreateTable statement).

Back to top