use of io.confluent.ksql.parser.tree.RunScript in project ksql by confluentinc.
the class StatementExecutor method executeStatement.
private void executeStatement(Statement statement, Command command, CommandId commandId, Map<QueryId, CommandId> terminatedQueries, boolean wasDropped) throws Exception {
String statementStr = command.getStatement();
DdlCommandResult result = null;
String successMessage = "";
if (statement instanceof DdlStatement) {
result = ksqlEngine.executeDdlStatement(statementStr, (DdlStatement) statement, command.getKsqlProperties());
} else if (statement instanceof CreateAsSelect) {
successMessage = handleCreateAsSelect((CreateAsSelect) statement, command, commandId, terminatedQueries, statementStr, wasDropped);
if (successMessage == null) {
return;
}
} else if (statement instanceof TerminateQuery) {
terminateQuery((TerminateQuery) statement);
successMessage = "Query terminated.";
} else if (statement instanceof RunScript) {
handleRunScript(command);
} else {
throw new Exception(String.format("Unexpected statement type: %s", statement.getClass().getName()));
}
// TODO: change to unified return message
CommandStatus successStatus = new CommandStatus(CommandStatus.Status.SUCCESS, result != null ? result.getMessage() : successMessage);
statusStore.put(commandId, successStatus);
completeStatusFuture(commandId, successStatus);
}
Aggregations