Skip to content


CommandFactories is a DdlCommandFactory.

Creating Instance

CommandFactories takes the following to be created:

CommandFactories is created alongside EngineContext

Creating DdlCommand

create is part of the DdlCommandFactory abstraction.

create creates a DdlCommand for a DdlStatement or a KsqlStructuredDataOutputNode.


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

create looks up (the class of) the given DdlStatement (in FACTORIES) 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]


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.


CommandFactories creates FACTORIES lookup table (of handlers) to create DdlCommands from DdlStatements.

DdlStatement Handler DdlCommand
AlterSource handleAlterSource AlterSourceCommand
CreateStream handleCreateStream CreateStreamCommand
CreateTable handleCreateTable CreateTableCommand
DropStream handleDropStream
DropTable handleDropTable
DropType handleDropType DropTypeCommand
RegisterType handleRegisterType RegisterTypeCommand


AlterSourceCommand handleAlterSource(
  AlterSource statement)

handleAlterSource requests the AlterSourceFactory for an AlterSourceCommand (for the given AlterSource statement).


CreateStreamCommand handleCreateStream(
  CallInfo callInfo,
  CreateStream statement)

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


CreateTableCommand handleCreateTable(
  CallInfo callInfo,
  CreateTable statement)

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