Search in sources :

Example 1 with DdlCommand

use of io.confluent.ksql.ddl.commands.DdlCommand in project ksql by confluentinc.

the class QueryEngine method handleDdlStatement.

DdlCommandResult handleDdlStatement(String sqlExpression, DdlStatement statement, final Map<String, Object> overriddenProperties) {
    if (statement instanceof AbstractStreamCreateStatement) {
        AbstractStreamCreateStatement streamCreateStatement = (AbstractStreamCreateStatement) statement;
        Pair<DdlStatement, String> avroCheckResult = maybeAddFieldsFromSchemaRegistry(streamCreateStatement);
        if (avroCheckResult.getRight() != null) {
            statement = avroCheckResult.getLeft();
            sqlExpression = avroCheckResult.getRight();
        }
    }
    DdlCommand command = ddlCommandFactory.create(sqlExpression, statement, overriddenProperties);
    return ksqlEngine.getDdlCommandExec().execute(command);
}
Also used : DdlCommand(io.confluent.ksql.ddl.commands.DdlCommand) DdlStatement(io.confluent.ksql.parser.tree.DdlStatement) AbstractStreamCreateStatement(io.confluent.ksql.parser.tree.AbstractStreamCreateStatement)

Aggregations

DdlCommand (io.confluent.ksql.ddl.commands.DdlCommand)1 AbstractStreamCreateStatement (io.confluent.ksql.parser.tree.AbstractStreamCreateStatement)1 DdlStatement (io.confluent.ksql.parser.tree.DdlStatement)1