in linkis-engineconn-plugins/flink/flink-core/src/main/java/org/apache/linkis/engineconnplugin/flink/client/sql/operation/OperationFactoryImpl.java [36:122]
public Operation createOperation(SqlCommandCall call, FlinkEngineConnContext context)
throws SqlParseException {
Operation operation;
switch (call.command) {
case SELECT:
operation = new SelectOperation(context, call.operands[0]);
break;
case CREATE_VIEW:
operation = new CreateViewOperation(context, call.operands[0], call.operands[1]);
break;
case DROP_VIEW:
operation =
new DropViewOperation(
context, call.operands[0], Boolean.parseBoolean(call.operands[1]));
break;
case CREATE_TABLE:
case CREATE_FUNCTION:
case DROP_TABLE:
case ALTER_TABLE:
case CREATE_CATALOG:
case DROP_CATALOG:
case CREATE_DATABASE:
case DROP_DATABASE:
case ALTER_DATABASE:
operation = new DDLOperation(context, call.operands[0], call.command);
break;
case SET:
// list all properties
if (call.operands.length == 0) {
operation = new SetOperation(context);
} else {
// set a property
operation = new SetOperation(context, call.operands[0], call.operands[1]);
}
break;
case RESET:
if (call.operands.length > 0) {
throw new SqlParseException(ONLY_RESET_ALL.getErrorDesc());
}
operation = new ResetOperation(context);
break;
case USE_CATALOG:
operation = new UseCatalogOperation(context, call.operands[0]);
break;
case USE:
operation = new UseDatabaseOperation(context, call.operands[0]);
break;
case INSERT_INTO:
case INSERT_OVERWRITE:
operation = new InsertOperation(context, call.operands[0], call.operands[1]);
break;
case SHOW_MODULES:
operation = new ShowModulesOperation(context);
break;
case SHOW_CATALOGS:
operation = new ShowCatalogsOperation(context);
break;
case SHOW_CURRENT_CATALOG:
operation = new ShowCurrentCatalogOperation(context);
break;
case SHOW_DATABASES:
operation = new ShowDatabasesOperation(context);
break;
case SHOW_CURRENT_DATABASE:
operation = new ShowCurrentDatabaseOperation(context);
break;
case SHOW_TABLES:
operation = new ShowTablesOperation(context);
break;
case SHOW_VIEWS:
operation = new ShowViewsOperation(context);
break;
case SHOW_FUNCTIONS:
operation = new ShowFunctionsOperation(context);
break;
case DESCRIBE_TABLE:
operation = new DescribeTableOperation(context, call.operands[0]);
break;
case EXPLAIN:
operation = new ExplainOperation(context, call.operands[0]);
break;
default:
throw new SqlParseException(
MessageFormat.format(SUPPORTED_COMMAND_CALL.getErrorDesc(), call));
}
return operation;
}