Search in sources :

Example 1 with CreateViewOperation

use of org.apache.flink.table.operations.ddl.CreateViewOperation in project flink by apache.

the class TableEnvironmentImpl method executeInternal.

@Override
public TableResultInternal executeInternal(Operation operation) {
    if (operation instanceof ModifyOperation) {
        return executeInternal(Collections.singletonList((ModifyOperation) operation));
    } else if (operation instanceof StatementSetOperation) {
        return executeInternal(((StatementSetOperation) operation).getOperations());
    } else if (operation instanceof CreateTableOperation) {
        CreateTableOperation createTableOperation = (CreateTableOperation) operation;
        if (createTableOperation.isTemporary()) {
            catalogManager.createTemporaryTable(createTableOperation.getCatalogTable(), createTableOperation.getTableIdentifier(), createTableOperation.isIgnoreIfExists());
        } else {
            catalogManager.createTable(createTableOperation.getCatalogTable(), createTableOperation.getTableIdentifier(), createTableOperation.isIgnoreIfExists());
        }
        return TableResultImpl.TABLE_RESULT_OK;
    } else if (operation instanceof DropTableOperation) {
        DropTableOperation dropTableOperation = (DropTableOperation) operation;
        if (dropTableOperation.isTemporary()) {
            catalogManager.dropTemporaryTable(dropTableOperation.getTableIdentifier(), dropTableOperation.isIfExists());
        } else {
            catalogManager.dropTable(dropTableOperation.getTableIdentifier(), dropTableOperation.isIfExists());
        }
        return TableResultImpl.TABLE_RESULT_OK;
    } else if (operation instanceof AlterTableOperation) {
        AlterTableOperation alterTableOperation = (AlterTableOperation) operation;
        Catalog catalog = getCatalogOrThrowException(alterTableOperation.getTableIdentifier().getCatalogName());
        String exMsg = getDDLOpExecuteErrorMsg(alterTableOperation.asSummaryString());
        try {
            if (alterTableOperation instanceof AlterTableRenameOperation) {
                AlterTableRenameOperation alterTableRenameOp = (AlterTableRenameOperation) operation;
                catalog.renameTable(alterTableRenameOp.getTableIdentifier().toObjectPath(), alterTableRenameOp.getNewTableIdentifier().getObjectName(), false);
            } else if (alterTableOperation instanceof AlterTableOptionsOperation) {
                AlterTableOptionsOperation alterTablePropertiesOp = (AlterTableOptionsOperation) operation;
                catalogManager.alterTable(alterTablePropertiesOp.getCatalogTable(), alterTablePropertiesOp.getTableIdentifier(), false);
            } else if (alterTableOperation instanceof AlterTableAddConstraintOperation) {
                AlterTableAddConstraintOperation addConstraintOP = (AlterTableAddConstraintOperation) operation;
                CatalogTable oriTable = catalogManager.getTable(addConstraintOP.getTableIdentifier()).get().getTable();
                TableSchema.Builder builder = TableSchemaUtils.builderWithGivenSchema(oriTable.getSchema());
                if (addConstraintOP.getConstraintName().isPresent()) {
                    builder.primaryKey(addConstraintOP.getConstraintName().get(), addConstraintOP.getColumnNames());
                } else {
                    builder.primaryKey(addConstraintOP.getColumnNames());
                }
                CatalogTable newTable = new CatalogTableImpl(builder.build(), oriTable.getPartitionKeys(), oriTable.getOptions(), oriTable.getComment());
                catalogManager.alterTable(newTable, addConstraintOP.getTableIdentifier(), false);
            } else if (alterTableOperation instanceof AlterTableDropConstraintOperation) {
                AlterTableDropConstraintOperation dropConstraintOperation = (AlterTableDropConstraintOperation) operation;
                CatalogTable oriTable = catalogManager.getTable(dropConstraintOperation.getTableIdentifier()).get().getTable();
                CatalogTable newTable = new CatalogTableImpl(TableSchemaUtils.dropConstraint(oriTable.getSchema(), dropConstraintOperation.getConstraintName()), oriTable.getPartitionKeys(), oriTable.getOptions(), oriTable.getComment());
                catalogManager.alterTable(newTable, dropConstraintOperation.getTableIdentifier(), false);
            } else if (alterTableOperation instanceof AlterPartitionPropertiesOperation) {
                AlterPartitionPropertiesOperation alterPartPropsOp = (AlterPartitionPropertiesOperation) operation;
                catalog.alterPartition(alterPartPropsOp.getTableIdentifier().toObjectPath(), alterPartPropsOp.getPartitionSpec(), alterPartPropsOp.getCatalogPartition(), false);
            } else if (alterTableOperation instanceof AlterTableSchemaOperation) {
                AlterTableSchemaOperation alterTableSchemaOperation = (AlterTableSchemaOperation) alterTableOperation;
                catalogManager.alterTable(alterTableSchemaOperation.getCatalogTable(), alterTableSchemaOperation.getTableIdentifier(), false);
            } else if (alterTableOperation instanceof AddPartitionsOperation) {
                AddPartitionsOperation addPartitionsOperation = (AddPartitionsOperation) alterTableOperation;
                List<CatalogPartitionSpec> specs = addPartitionsOperation.getPartitionSpecs();
                List<CatalogPartition> partitions = addPartitionsOperation.getCatalogPartitions();
                boolean ifNotExists = addPartitionsOperation.ifNotExists();
                ObjectPath tablePath = addPartitionsOperation.getTableIdentifier().toObjectPath();
                for (int i = 0; i < specs.size(); i++) {
                    catalog.createPartition(tablePath, specs.get(i), partitions.get(i), ifNotExists);
                }
            } else if (alterTableOperation instanceof DropPartitionsOperation) {
                DropPartitionsOperation dropPartitionsOperation = (DropPartitionsOperation) alterTableOperation;
                ObjectPath tablePath = dropPartitionsOperation.getTableIdentifier().toObjectPath();
                boolean ifExists = dropPartitionsOperation.ifExists();
                for (CatalogPartitionSpec spec : dropPartitionsOperation.getPartitionSpecs()) {
                    catalog.dropPartition(tablePath, spec, ifExists);
                }
            }
            return TableResultImpl.TABLE_RESULT_OK;
        } catch (TableAlreadyExistException | TableNotExistException e) {
            throw new ValidationException(exMsg, e);
        } catch (Exception e) {
            throw new TableException(exMsg, e);
        }
    } else if (operation instanceof CreateViewOperation) {
        CreateViewOperation createViewOperation = (CreateViewOperation) operation;
        if (createViewOperation.isTemporary()) {
            catalogManager.createTemporaryTable(createViewOperation.getCatalogView(), createViewOperation.getViewIdentifier(), createViewOperation.isIgnoreIfExists());
        } else {
            catalogManager.createTable(createViewOperation.getCatalogView(), createViewOperation.getViewIdentifier(), createViewOperation.isIgnoreIfExists());
        }
        return TableResultImpl.TABLE_RESULT_OK;
    } else if (operation instanceof DropViewOperation) {
        DropViewOperation dropViewOperation = (DropViewOperation) operation;
        if (dropViewOperation.isTemporary()) {
            catalogManager.dropTemporaryView(dropViewOperation.getViewIdentifier(), dropViewOperation.isIfExists());
        } else {
            catalogManager.dropView(dropViewOperation.getViewIdentifier(), dropViewOperation.isIfExists());
        }
        return TableResultImpl.TABLE_RESULT_OK;
    } else if (operation instanceof AlterViewOperation) {
        AlterViewOperation alterViewOperation = (AlterViewOperation) operation;
        Catalog catalog = getCatalogOrThrowException(alterViewOperation.getViewIdentifier().getCatalogName());
        String exMsg = getDDLOpExecuteErrorMsg(alterViewOperation.asSummaryString());
        try {
            if (alterViewOperation instanceof AlterViewRenameOperation) {
                AlterViewRenameOperation alterTableRenameOp = (AlterViewRenameOperation) operation;
                catalog.renameTable(alterTableRenameOp.getViewIdentifier().toObjectPath(), alterTableRenameOp.getNewViewIdentifier().getObjectName(), false);
            } else if (alterViewOperation instanceof AlterViewPropertiesOperation) {
                AlterViewPropertiesOperation alterTablePropertiesOp = (AlterViewPropertiesOperation) operation;
                catalogManager.alterTable(alterTablePropertiesOp.getCatalogView(), alterTablePropertiesOp.getViewIdentifier(), false);
            } else if (alterViewOperation instanceof AlterViewAsOperation) {
                AlterViewAsOperation alterViewAsOperation = (AlterViewAsOperation) alterViewOperation;
                catalogManager.alterTable(alterViewAsOperation.getNewView(), alterViewAsOperation.getViewIdentifier(), false);
            }
            return TableResultImpl.TABLE_RESULT_OK;
        } catch (TableAlreadyExistException | TableNotExistException e) {
            throw new ValidationException(exMsg, e);
        } catch (Exception e) {
            throw new TableException(exMsg, e);
        }
    } else if (operation instanceof CreateDatabaseOperation) {
        CreateDatabaseOperation createDatabaseOperation = (CreateDatabaseOperation) operation;
        Catalog catalog = getCatalogOrThrowException(createDatabaseOperation.getCatalogName());
        String exMsg = getDDLOpExecuteErrorMsg(createDatabaseOperation.asSummaryString());
        try {
            catalog.createDatabase(createDatabaseOperation.getDatabaseName(), createDatabaseOperation.getCatalogDatabase(), createDatabaseOperation.isIgnoreIfExists());
            return TableResultImpl.TABLE_RESULT_OK;
        } catch (DatabaseAlreadyExistException e) {
            throw new ValidationException(exMsg, e);
        } catch (Exception e) {
            throw new TableException(exMsg, e);
        }
    } else if (operation instanceof DropDatabaseOperation) {
        DropDatabaseOperation dropDatabaseOperation = (DropDatabaseOperation) operation;
        Catalog catalog = getCatalogOrThrowException(dropDatabaseOperation.getCatalogName());
        String exMsg = getDDLOpExecuteErrorMsg(dropDatabaseOperation.asSummaryString());
        try {
            catalog.dropDatabase(dropDatabaseOperation.getDatabaseName(), dropDatabaseOperation.isIfExists(), dropDatabaseOperation.isCascade());
            return TableResultImpl.TABLE_RESULT_OK;
        } catch (DatabaseNotExistException | DatabaseNotEmptyException e) {
            throw new ValidationException(exMsg, e);
        } catch (Exception e) {
            throw new TableException(exMsg, e);
        }
    } else if (operation instanceof AlterDatabaseOperation) {
        AlterDatabaseOperation alterDatabaseOperation = (AlterDatabaseOperation) operation;
        Catalog catalog = getCatalogOrThrowException(alterDatabaseOperation.getCatalogName());
        String exMsg = getDDLOpExecuteErrorMsg(alterDatabaseOperation.asSummaryString());
        try {
            catalog.alterDatabase(alterDatabaseOperation.getDatabaseName(), alterDatabaseOperation.getCatalogDatabase(), false);
            return TableResultImpl.TABLE_RESULT_OK;
        } catch (DatabaseNotExistException e) {
            throw new ValidationException(exMsg, e);
        } catch (Exception e) {
            throw new TableException(exMsg, e);
        }
    } else if (operation instanceof CreateCatalogFunctionOperation) {
        return createCatalogFunction((CreateCatalogFunctionOperation) operation);
    } else if (operation instanceof CreateTempSystemFunctionOperation) {
        return createSystemFunction((CreateTempSystemFunctionOperation) operation);
    } else if (operation instanceof DropCatalogFunctionOperation) {
        return dropCatalogFunction((DropCatalogFunctionOperation) operation);
    } else if (operation instanceof DropTempSystemFunctionOperation) {
        return dropSystemFunction((DropTempSystemFunctionOperation) operation);
    } else if (operation instanceof AlterCatalogFunctionOperation) {
        return alterCatalogFunction((AlterCatalogFunctionOperation) operation);
    } else if (operation instanceof CreateCatalogOperation) {
        return createCatalog((CreateCatalogOperation) operation);
    } else if (operation instanceof DropCatalogOperation) {
        DropCatalogOperation dropCatalogOperation = (DropCatalogOperation) operation;
        String exMsg = getDDLOpExecuteErrorMsg(dropCatalogOperation.asSummaryString());
        try {
            catalogManager.unregisterCatalog(dropCatalogOperation.getCatalogName(), dropCatalogOperation.isIfExists());
            return TableResultImpl.TABLE_RESULT_OK;
        } catch (CatalogException e) {
            throw new ValidationException(exMsg, e);
        }
    } else if (operation instanceof LoadModuleOperation) {
        return loadModule((LoadModuleOperation) operation);
    } else if (operation instanceof UnloadModuleOperation) {
        return unloadModule((UnloadModuleOperation) operation);
    } else if (operation instanceof UseModulesOperation) {
        return useModules((UseModulesOperation) operation);
    } else if (operation instanceof UseCatalogOperation) {
        UseCatalogOperation useCatalogOperation = (UseCatalogOperation) operation;
        catalogManager.setCurrentCatalog(useCatalogOperation.getCatalogName());
        return TableResultImpl.TABLE_RESULT_OK;
    } else if (operation instanceof UseDatabaseOperation) {
        UseDatabaseOperation useDatabaseOperation = (UseDatabaseOperation) operation;
        catalogManager.setCurrentCatalog(useDatabaseOperation.getCatalogName());
        catalogManager.setCurrentDatabase(useDatabaseOperation.getDatabaseName());
        return TableResultImpl.TABLE_RESULT_OK;
    } else if (operation instanceof ShowCatalogsOperation) {
        return buildShowResult("catalog name", listCatalogs());
    } else if (operation instanceof ShowCreateTableOperation) {
        ShowCreateTableOperation showCreateTableOperation = (ShowCreateTableOperation) operation;
        ContextResolvedTable table = catalogManager.getTable(showCreateTableOperation.getTableIdentifier()).orElseThrow(() -> new ValidationException(String.format("Could not execute SHOW CREATE TABLE. Table with identifier %s does not exist.", showCreateTableOperation.getTableIdentifier().asSerializableString())));
        return TableResultImpl.builder().resultKind(ResultKind.SUCCESS_WITH_CONTENT).schema(ResolvedSchema.of(Column.physical("result", DataTypes.STRING()))).data(Collections.singletonList(Row.of(ShowCreateUtil.buildShowCreateTableRow(table.getResolvedTable(), showCreateTableOperation.getTableIdentifier(), table.isTemporary())))).build();
    } else if (operation instanceof ShowCreateViewOperation) {
        ShowCreateViewOperation showCreateViewOperation = (ShowCreateViewOperation) operation;
        final ContextResolvedTable table = catalogManager.getTable(showCreateViewOperation.getViewIdentifier()).orElseThrow(() -> new ValidationException(String.format("Could not execute SHOW CREATE VIEW. View with identifier %s does not exist.", showCreateViewOperation.getViewIdentifier().asSerializableString())));
        return TableResultImpl.builder().resultKind(ResultKind.SUCCESS_WITH_CONTENT).schema(ResolvedSchema.of(Column.physical("result", DataTypes.STRING()))).data(Collections.singletonList(Row.of(ShowCreateUtil.buildShowCreateViewRow(table.getResolvedTable(), showCreateViewOperation.getViewIdentifier(), table.isTemporary())))).build();
    } else if (operation instanceof ShowCurrentCatalogOperation) {
        return buildShowResult("current catalog name", new String[] { catalogManager.getCurrentCatalog() });
    } else if (operation instanceof ShowDatabasesOperation) {
        return buildShowResult("database name", listDatabases());
    } else if (operation instanceof ShowCurrentDatabaseOperation) {
        return buildShowResult("current database name", new String[] { catalogManager.getCurrentDatabase() });
    } else if (operation instanceof ShowModulesOperation) {
        ShowModulesOperation showModulesOperation = (ShowModulesOperation) operation;
        if (showModulesOperation.requireFull()) {
            return buildShowFullModulesResult(listFullModules());
        } else {
            return buildShowResult("module name", listModules());
        }
    } else if (operation instanceof ShowTablesOperation) {
        return buildShowResult("table name", listTables());
    } else if (operation instanceof ShowFunctionsOperation) {
        ShowFunctionsOperation showFunctionsOperation = (ShowFunctionsOperation) operation;
        String[] functionNames = null;
        ShowFunctionsOperation.FunctionScope functionScope = showFunctionsOperation.getFunctionScope();
        switch(functionScope) {
            case USER:
                functionNames = listUserDefinedFunctions();
                break;
            case ALL:
                functionNames = listFunctions();
                break;
            default:
                throw new UnsupportedOperationException(String.format("SHOW FUNCTIONS with %s scope is not supported.", functionScope));
        }
        return buildShowResult("function name", functionNames);
    } else if (operation instanceof ShowViewsOperation) {
        return buildShowResult("view name", listViews());
    } else if (operation instanceof ShowColumnsOperation) {
        ShowColumnsOperation showColumnsOperation = (ShowColumnsOperation) operation;
        Optional<ContextResolvedTable> result = catalogManager.getTable(showColumnsOperation.getTableIdentifier());
        if (result.isPresent()) {
            return buildShowColumnsResult(result.get().getResolvedSchema(), showColumnsOperation);
        } else {
            throw new ValidationException(String.format("Tables or views with the identifier '%s' doesn't exist.", showColumnsOperation.getTableIdentifier().asSummaryString()));
        }
    } else if (operation instanceof ShowPartitionsOperation) {
        String exMsg = getDDLOpExecuteErrorMsg(operation.asSummaryString());
        try {
            ShowPartitionsOperation showPartitionsOperation = (ShowPartitionsOperation) operation;
            Catalog catalog = getCatalogOrThrowException(showPartitionsOperation.getTableIdentifier().getCatalogName());
            ObjectPath tablePath = showPartitionsOperation.getTableIdentifier().toObjectPath();
            CatalogPartitionSpec partitionSpec = showPartitionsOperation.getPartitionSpec();
            List<CatalogPartitionSpec> partitionSpecs = partitionSpec == null ? catalog.listPartitions(tablePath) : catalog.listPartitions(tablePath, partitionSpec);
            List<String> partitionNames = new ArrayList<>(partitionSpecs.size());
            for (CatalogPartitionSpec spec : partitionSpecs) {
                List<String> partitionKVs = new ArrayList<>(spec.getPartitionSpec().size());
                for (Map.Entry<String, String> partitionKV : spec.getPartitionSpec().entrySet()) {
                    partitionKVs.add(partitionKV.getKey() + "=" + partitionKV.getValue());
                }
                partitionNames.add(String.join("/", partitionKVs));
            }
            return buildShowResult("partition name", partitionNames.toArray(new String[0]));
        } catch (TableNotExistException e) {
            throw new ValidationException(exMsg, e);
        } catch (Exception e) {
            throw new TableException(exMsg, e);
        }
    } else if (operation instanceof ExplainOperation) {
        ExplainOperation explainOperation = (ExplainOperation) operation;
        ExplainDetail[] explainDetails = explainOperation.getExplainDetails().stream().map(ExplainDetail::valueOf).toArray(ExplainDetail[]::new);
        Operation child = ((ExplainOperation) operation).getChild();
        List<Operation> operations;
        if (child instanceof StatementSetOperation) {
            operations = new ArrayList<>(((StatementSetOperation) child).getOperations());
        } else {
            operations = Collections.singletonList(child);
        }
        String explanation = explainInternal(operations, explainDetails);
        return TableResultImpl.builder().resultKind(ResultKind.SUCCESS_WITH_CONTENT).schema(ResolvedSchema.of(Column.physical("result", DataTypes.STRING()))).data(Collections.singletonList(Row.of(explanation))).build();
    } else if (operation instanceof DescribeTableOperation) {
        DescribeTableOperation describeTableOperation = (DescribeTableOperation) operation;
        Optional<ContextResolvedTable> result = catalogManager.getTable(describeTableOperation.getSqlIdentifier());
        if (result.isPresent()) {
            return buildDescribeResult(result.get().getResolvedSchema());
        } else {
            throw new ValidationException(String.format("Tables or views with the identifier '%s' doesn't exist", describeTableOperation.getSqlIdentifier().asSummaryString()));
        }
    } else if (operation instanceof QueryOperation) {
        return executeQueryOperation((QueryOperation) operation);
    } else if (operation instanceof CreateTableASOperation) {
        CreateTableASOperation createTableASOperation = (CreateTableASOperation) operation;
        executeInternal(createTableASOperation.getCreateTableOperation());
        return executeInternal(createTableASOperation.toSinkModifyOperation(catalogManager));
    } else if (operation instanceof ExecutePlanOperation) {
        ExecutePlanOperation executePlanOperation = (ExecutePlanOperation) operation;
        return (TableResultInternal) executePlan(PlanReference.fromFile(executePlanOperation.getFilePath()));
    } else if (operation instanceof CompilePlanOperation) {
        CompilePlanOperation compilePlanOperation = (CompilePlanOperation) operation;
        compilePlanAndWrite(compilePlanOperation.getFilePath(), compilePlanOperation.isIfNotExists(), compilePlanOperation.getOperation());
        return TableResultImpl.TABLE_RESULT_OK;
    } else if (operation instanceof CompileAndExecutePlanOperation) {
        CompileAndExecutePlanOperation compileAndExecutePlanOperation = (CompileAndExecutePlanOperation) operation;
        CompiledPlan compiledPlan = compilePlanAndWrite(compileAndExecutePlanOperation.getFilePath(), true, compileAndExecutePlanOperation.getOperation());
        return (TableResultInternal) executePlan(compiledPlan);
    } else if (operation instanceof NopOperation) {
        return TableResultImpl.TABLE_RESULT_OK;
    } else {
        throw new TableException(UNSUPPORTED_QUERY_IN_EXECUTE_SQL_MSG);
    }
}
Also used : NopOperation(org.apache.flink.table.operations.NopOperation) AlterViewOperation(org.apache.flink.table.operations.ddl.AlterViewOperation) AlterViewAsOperation(org.apache.flink.table.operations.ddl.AlterViewAsOperation) ShowCurrentCatalogOperation(org.apache.flink.table.operations.ShowCurrentCatalogOperation) CatalogException(org.apache.flink.table.catalog.exceptions.CatalogException) ArrayList(java.util.ArrayList) AlterViewRenameOperation(org.apache.flink.table.operations.ddl.AlterViewRenameOperation) ShowPartitionsOperation(org.apache.flink.table.operations.ShowPartitionsOperation) StatementSetOperation(org.apache.flink.table.operations.StatementSetOperation) ExecutePlanOperation(org.apache.flink.table.operations.command.ExecutePlanOperation) CompileAndExecutePlanOperation(org.apache.flink.table.operations.CompileAndExecutePlanOperation) CatalogTableImpl(org.apache.flink.table.catalog.CatalogTableImpl) ShowCreateViewOperation(org.apache.flink.table.operations.ShowCreateViewOperation) CreateViewOperation(org.apache.flink.table.operations.ddl.CreateViewOperation) CompileAndExecutePlanOperation(org.apache.flink.table.operations.CompileAndExecutePlanOperation) AlterPartitionPropertiesOperation(org.apache.flink.table.operations.ddl.AlterPartitionPropertiesOperation) ArrayList(java.util.ArrayList) List(java.util.List) UseCatalogOperation(org.apache.flink.table.operations.UseCatalogOperation) AddPartitionsOperation(org.apache.flink.table.operations.ddl.AddPartitionsOperation) CatalogPartitionSpec(org.apache.flink.table.catalog.CatalogPartitionSpec) CreateTempSystemFunctionOperation(org.apache.flink.table.operations.ddl.CreateTempSystemFunctionOperation) AlterViewPropertiesOperation(org.apache.flink.table.operations.ddl.AlterViewPropertiesOperation) CompiledPlan(org.apache.flink.table.api.CompiledPlan) DropPartitionsOperation(org.apache.flink.table.operations.ddl.DropPartitionsOperation) Optional(java.util.Optional) DropDatabaseOperation(org.apache.flink.table.operations.ddl.DropDatabaseOperation) ShowViewsOperation(org.apache.flink.table.operations.ShowViewsOperation) Catalog(org.apache.flink.table.catalog.Catalog) GenericInMemoryCatalog(org.apache.flink.table.catalog.GenericInMemoryCatalog) FunctionCatalog(org.apache.flink.table.catalog.FunctionCatalog) ExplainDetail(org.apache.flink.table.api.ExplainDetail) ShowCurrentDatabaseOperation(org.apache.flink.table.operations.ShowCurrentDatabaseOperation) AlterTableOperation(org.apache.flink.table.operations.ddl.AlterTableOperation) DropTableOperation(org.apache.flink.table.operations.ddl.DropTableOperation) CatalogPartition(org.apache.flink.table.catalog.CatalogPartition) ModifyOperation(org.apache.flink.table.operations.ModifyOperation) SinkModifyOperation(org.apache.flink.table.operations.SinkModifyOperation) CollectModifyOperation(org.apache.flink.table.operations.CollectModifyOperation) DatabaseNotExistException(org.apache.flink.table.catalog.exceptions.DatabaseNotExistException) ShowDatabasesOperation(org.apache.flink.table.operations.ShowDatabasesOperation) ContextResolvedTable(org.apache.flink.table.catalog.ContextResolvedTable) Map(java.util.Map) HashMap(java.util.HashMap) DatabaseAlreadyExistException(org.apache.flink.table.catalog.exceptions.DatabaseAlreadyExistException) DropTempSystemFunctionOperation(org.apache.flink.table.operations.ddl.DropTempSystemFunctionOperation) AlterTableOptionsOperation(org.apache.flink.table.operations.ddl.AlterTableOptionsOperation) ObjectPath(org.apache.flink.table.catalog.ObjectPath) AlterDatabaseOperation(org.apache.flink.table.operations.ddl.AlterDatabaseOperation) ValidationException(org.apache.flink.table.api.ValidationException) TableSchema(org.apache.flink.table.api.TableSchema) CreateCatalogOperation(org.apache.flink.table.operations.ddl.CreateCatalogOperation) DropCatalogFunctionOperation(org.apache.flink.table.operations.ddl.DropCatalogFunctionOperation) TableNotExistException(org.apache.flink.table.catalog.exceptions.TableNotExistException) CreateTableOperation(org.apache.flink.table.operations.ddl.CreateTableOperation) ShowCreateTableOperation(org.apache.flink.table.operations.ShowCreateTableOperation) AlterTableAddConstraintOperation(org.apache.flink.table.operations.ddl.AlterTableAddConstraintOperation) ModifyOperation(org.apache.flink.table.operations.ModifyOperation) ShowCurrentDatabaseOperation(org.apache.flink.table.operations.ShowCurrentDatabaseOperation) ExecutePlanOperation(org.apache.flink.table.operations.command.ExecutePlanOperation) DropDatabaseOperation(org.apache.flink.table.operations.ddl.DropDatabaseOperation) SinkModifyOperation(org.apache.flink.table.operations.SinkModifyOperation) ShowColumnsOperation(org.apache.flink.table.operations.ShowColumnsOperation) AlterTableOptionsOperation(org.apache.flink.table.operations.ddl.AlterTableOptionsOperation) AlterTableDropConstraintOperation(org.apache.flink.table.operations.ddl.AlterTableDropConstraintOperation) CompilePlanOperation(org.apache.flink.table.operations.ddl.CompilePlanOperation) CreateCatalogOperation(org.apache.flink.table.operations.ddl.CreateCatalogOperation) ShowCreateViewOperation(org.apache.flink.table.operations.ShowCreateViewOperation) UseCatalogOperation(org.apache.flink.table.operations.UseCatalogOperation) UseDatabaseOperation(org.apache.flink.table.operations.UseDatabaseOperation) ShowCatalogsOperation(org.apache.flink.table.operations.ShowCatalogsOperation) CollectModifyOperation(org.apache.flink.table.operations.CollectModifyOperation) CreateViewOperation(org.apache.flink.table.operations.ddl.CreateViewOperation) AlterDatabaseOperation(org.apache.flink.table.operations.ddl.AlterDatabaseOperation) QueryOperation(org.apache.flink.table.operations.QueryOperation) CompileAndExecutePlanOperation(org.apache.flink.table.operations.CompileAndExecutePlanOperation) UseModulesOperation(org.apache.flink.table.operations.UseModulesOperation) DropCatalogFunctionOperation(org.apache.flink.table.operations.ddl.DropCatalogFunctionOperation) ShowTablesOperation(org.apache.flink.table.operations.ShowTablesOperation) DescribeTableOperation(org.apache.flink.table.operations.DescribeTableOperation) ShowCurrentCatalogOperation(org.apache.flink.table.operations.ShowCurrentCatalogOperation) AlterTableOperation(org.apache.flink.table.operations.ddl.AlterTableOperation) ShowFunctionsOperation(org.apache.flink.table.operations.ShowFunctionsOperation) CreateDatabaseOperation(org.apache.flink.table.operations.ddl.CreateDatabaseOperation) NopOperation(org.apache.flink.table.operations.NopOperation) AlterPartitionPropertiesOperation(org.apache.flink.table.operations.ddl.AlterPartitionPropertiesOperation) ShowPartitionsOperation(org.apache.flink.table.operations.ShowPartitionsOperation) AlterViewPropertiesOperation(org.apache.flink.table.operations.ddl.AlterViewPropertiesOperation) AlterViewOperation(org.apache.flink.table.operations.ddl.AlterViewOperation) LoadModuleOperation(org.apache.flink.table.operations.LoadModuleOperation) Operation(org.apache.flink.table.operations.Operation) AlterCatalogFunctionOperation(org.apache.flink.table.operations.ddl.AlterCatalogFunctionOperation) DropTempSystemFunctionOperation(org.apache.flink.table.operations.ddl.DropTempSystemFunctionOperation) TableSourceQueryOperation(org.apache.flink.table.operations.TableSourceQueryOperation) ShowViewsOperation(org.apache.flink.table.operations.ShowViewsOperation) ShowDatabasesOperation(org.apache.flink.table.operations.ShowDatabasesOperation) AlterTableSchemaOperation(org.apache.flink.table.operations.ddl.AlterTableSchemaOperation) CreateTableASOperation(org.apache.flink.table.operations.ddl.CreateTableASOperation) ShowModulesOperation(org.apache.flink.table.operations.ShowModulesOperation) SourceQueryOperation(org.apache.flink.table.operations.SourceQueryOperation) UnloadModuleOperation(org.apache.flink.table.operations.UnloadModuleOperation) DropTableOperation(org.apache.flink.table.operations.ddl.DropTableOperation) AlterViewAsOperation(org.apache.flink.table.operations.ddl.AlterViewAsOperation) CreateTableOperation(org.apache.flink.table.operations.ddl.CreateTableOperation) DropViewOperation(org.apache.flink.table.operations.ddl.DropViewOperation) AddPartitionsOperation(org.apache.flink.table.operations.ddl.AddPartitionsOperation) DropPartitionsOperation(org.apache.flink.table.operations.ddl.DropPartitionsOperation) AlterTableAddConstraintOperation(org.apache.flink.table.operations.ddl.AlterTableAddConstraintOperation) ExplainOperation(org.apache.flink.table.operations.ExplainOperation) StatementSetOperation(org.apache.flink.table.operations.StatementSetOperation) DropCatalogOperation(org.apache.flink.table.operations.ddl.DropCatalogOperation) AlterTableRenameOperation(org.apache.flink.table.operations.ddl.AlterTableRenameOperation) ShowCreateTableOperation(org.apache.flink.table.operations.ShowCreateTableOperation) AlterViewRenameOperation(org.apache.flink.table.operations.ddl.AlterViewRenameOperation) CreateCatalogFunctionOperation(org.apache.flink.table.operations.ddl.CreateCatalogFunctionOperation) CreateTempSystemFunctionOperation(org.apache.flink.table.operations.ddl.CreateTempSystemFunctionOperation) AlterTableDropConstraintOperation(org.apache.flink.table.operations.ddl.AlterTableDropConstraintOperation) LoadModuleOperation(org.apache.flink.table.operations.LoadModuleOperation) ShowCreateViewOperation(org.apache.flink.table.operations.ShowCreateViewOperation) TableAlreadyExistException(org.apache.flink.table.catalog.exceptions.TableAlreadyExistException) CreateCatalogFunctionOperation(org.apache.flink.table.operations.ddl.CreateCatalogFunctionOperation) AlterCatalogFunctionOperation(org.apache.flink.table.operations.ddl.AlterCatalogFunctionOperation) CreateTableASOperation(org.apache.flink.table.operations.ddl.CreateTableASOperation) AlterTableSchemaOperation(org.apache.flink.table.operations.ddl.AlterTableSchemaOperation) ShowColumnsOperation(org.apache.flink.table.operations.ShowColumnsOperation) CompilePlanOperation(org.apache.flink.table.operations.ddl.CompilePlanOperation) QueryOperation(org.apache.flink.table.operations.QueryOperation) TableSourceQueryOperation(org.apache.flink.table.operations.TableSourceQueryOperation) SourceQueryOperation(org.apache.flink.table.operations.SourceQueryOperation) TableException(org.apache.flink.table.api.TableException) ExplainOperation(org.apache.flink.table.operations.ExplainOperation) ShowCatalogsOperation(org.apache.flink.table.operations.ShowCatalogsOperation) UnloadModuleOperation(org.apache.flink.table.operations.UnloadModuleOperation) DropCatalogOperation(org.apache.flink.table.operations.ddl.DropCatalogOperation) ShowCreateTableOperation(org.apache.flink.table.operations.ShowCreateTableOperation) CatalogTable(org.apache.flink.table.catalog.CatalogTable) ConnectorCatalogTable(org.apache.flink.table.catalog.ConnectorCatalogTable) ResolvedCatalogTable(org.apache.flink.table.catalog.ResolvedCatalogTable) DescribeTableOperation(org.apache.flink.table.operations.DescribeTableOperation) UseDatabaseOperation(org.apache.flink.table.operations.UseDatabaseOperation) FunctionAlreadyExistException(org.apache.flink.table.catalog.exceptions.FunctionAlreadyExistException) DatabaseNotExistException(org.apache.flink.table.catalog.exceptions.DatabaseNotExistException) TableAlreadyExistException(org.apache.flink.table.catalog.exceptions.TableAlreadyExistException) TableException(org.apache.flink.table.api.TableException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) CatalogException(org.apache.flink.table.catalog.exceptions.CatalogException) FunctionNotExistException(org.apache.flink.table.catalog.exceptions.FunctionNotExistException) DatabaseNotEmptyException(org.apache.flink.table.catalog.exceptions.DatabaseNotEmptyException) DatabaseAlreadyExistException(org.apache.flink.table.catalog.exceptions.DatabaseAlreadyExistException) SqlParserException(org.apache.flink.table.api.SqlParserException) ValidationException(org.apache.flink.table.api.ValidationException) TableNotExistException(org.apache.flink.table.catalog.exceptions.TableNotExistException) ShowFunctionsOperation(org.apache.flink.table.operations.ShowFunctionsOperation) AlterTableRenameOperation(org.apache.flink.table.operations.ddl.AlterTableRenameOperation) DropViewOperation(org.apache.flink.table.operations.ddl.DropViewOperation) UseModulesOperation(org.apache.flink.table.operations.UseModulesOperation) CreateDatabaseOperation(org.apache.flink.table.operations.ddl.CreateDatabaseOperation) ShowModulesOperation(org.apache.flink.table.operations.ShowModulesOperation) ShowTablesOperation(org.apache.flink.table.operations.ShowTablesOperation)

Example 2 with CreateViewOperation

use of org.apache.flink.table.operations.ddl.CreateViewOperation in project flink by apache.

the class SqlToOperationConverter method convertCreateView.

/**
 * Convert CREATE VIEW statement.
 */
private Operation convertCreateView(SqlCreateView sqlCreateView) {
    final SqlNode query = sqlCreateView.getQuery();
    final SqlNodeList fieldList = sqlCreateView.getFieldList();
    UnresolvedIdentifier unresolvedIdentifier = UnresolvedIdentifier.of(sqlCreateView.fullViewName());
    ObjectIdentifier identifier = catalogManager.qualifyIdentifier(unresolvedIdentifier);
    String comment = sqlCreateView.getComment().map(c -> c.getNlsString().getValue()).orElse(null);
    CatalogView catalogView = convertViewQuery(query, fieldList.getList(), OperationConverterUtils.extractProperties(sqlCreateView.getProperties().orElse(null)), comment);
    return new CreateViewOperation(identifier, catalogView, sqlCreateView.isIfNotExists(), sqlCreateView.isTemporary());
}
Also used : SqlAlterTableReset(org.apache.flink.sql.parser.ddl.SqlAlterTableReset) ModifyOperation(org.apache.flink.table.operations.ModifyOperation) SqlShowCurrentCatalog(org.apache.flink.sql.parser.dql.SqlShowCurrentCatalog) UnresolvedIdentifier(org.apache.flink.table.catalog.UnresolvedIdentifier) SqlTableOption(org.apache.flink.sql.parser.ddl.SqlTableOption) FlinkPlannerImpl(org.apache.flink.table.planner.calcite.FlinkPlannerImpl) CatalogTable(org.apache.flink.table.catalog.CatalogTable) ResolvedSchema(org.apache.flink.table.catalog.ResolvedSchema) ShowCurrentDatabaseOperation(org.apache.flink.table.operations.ShowCurrentDatabaseOperation) SqlDropPartitions(org.apache.flink.sql.parser.ddl.SqlDropPartitions) SqlShowViews(org.apache.flink.sql.parser.dql.SqlShowViews) SqlAlterFunction(org.apache.flink.sql.parser.ddl.SqlAlterFunction) SqlEndStatementSet(org.apache.flink.sql.parser.dml.SqlEndStatementSet) SqlRichDescribeTable(org.apache.flink.sql.parser.dql.SqlRichDescribeTable) SqlShowPartitions(org.apache.flink.sql.parser.dql.SqlShowPartitions) Map(java.util.Map) SqlRemoveJar(org.apache.flink.sql.parser.ddl.SqlRemoveJar) FlinkHints(org.apache.flink.table.planner.hint.FlinkHints) CatalogPartitionImpl(org.apache.flink.table.catalog.CatalogPartitionImpl) SqlCreateTable(org.apache.flink.sql.parser.ddl.SqlCreateTable) SqlShowCreateTable(org.apache.flink.sql.parser.dql.SqlShowCreateTable) ExecutePlanOperation(org.apache.flink.table.operations.command.ExecutePlanOperation) DropDatabaseOperation(org.apache.flink.table.operations.ddl.DropDatabaseOperation) SqlUseModules(org.apache.flink.sql.parser.ddl.SqlUseModules) SqlUseDatabase(org.apache.flink.sql.parser.ddl.SqlUseDatabase) SinkModifyOperation(org.apache.flink.table.operations.SinkModifyOperation) SqlChangeColumn(org.apache.flink.sql.parser.ddl.SqlChangeColumn) ShowColumnsOperation(org.apache.flink.table.operations.ShowColumnsOperation) SqlKind(org.apache.calcite.sql.SqlKind) SqlAlterTable(org.apache.flink.sql.parser.ddl.SqlAlterTable) AlterTableOptionsOperation(org.apache.flink.table.operations.ddl.AlterTableOptionsOperation) AlterTableDropConstraintOperation(org.apache.flink.table.operations.ddl.AlterTableDropConstraintOperation) Set(java.util.Set) TableSchema(org.apache.flink.table.api.TableSchema) SqlAddReplaceColumns(org.apache.flink.sql.parser.ddl.SqlAddReplaceColumns) CompilePlanOperation(org.apache.flink.table.operations.ddl.CompilePlanOperation) CreateCatalogOperation(org.apache.flink.table.operations.ddl.CreateCatalogOperation) SqlDropDatabase(org.apache.flink.sql.parser.ddl.SqlDropDatabase) ShowCreateViewOperation(org.apache.flink.table.operations.ShowCreateViewOperation) OperationConverterUtils(org.apache.flink.table.planner.utils.OperationConverterUtils) UseCatalogOperation(org.apache.flink.table.operations.UseCatalogOperation) UseDatabaseOperation(org.apache.flink.table.operations.UseDatabaseOperation) CatalogFunction(org.apache.flink.table.catalog.CatalogFunction) FactoryUtil(org.apache.flink.table.factories.FactoryUtil) ShowCatalogsOperation(org.apache.flink.table.operations.ShowCatalogsOperation) CatalogDatabaseImpl(org.apache.flink.table.catalog.CatalogDatabaseImpl) SqlAlterTableAddConstraint(org.apache.flink.sql.parser.ddl.SqlAlterTableAddConstraint) RichSqlInsert(org.apache.flink.sql.parser.dml.RichSqlInsert) CreateViewOperation(org.apache.flink.table.operations.ddl.CreateViewOperation) ShowJarsOperation(org.apache.flink.table.operations.command.ShowJarsOperation) AlterDatabaseOperation(org.apache.flink.table.operations.ddl.AlterDatabaseOperation) CatalogDatabase(org.apache.flink.table.catalog.CatalogDatabase) SqlAlterViewRename(org.apache.flink.sql.parser.ddl.SqlAlterViewRename) QueryOperation(org.apache.flink.table.operations.QueryOperation) ObjectIdentifier(org.apache.flink.table.catalog.ObjectIdentifier) SqlAlterDatabase(org.apache.flink.sql.parser.ddl.SqlAlterDatabase) CompileAndExecutePlanOperation(org.apache.flink.table.operations.CompileAndExecutePlanOperation) CatalogFunctionImpl(org.apache.flink.table.catalog.CatalogFunctionImpl) SqlUnloadModule(org.apache.flink.sql.parser.dql.SqlUnloadModule) DatabaseNotExistException(org.apache.flink.table.catalog.exceptions.DatabaseNotExistException) EndStatementSetOperation(org.apache.flink.table.operations.EndStatementSetOperation) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) SqlShowCreateView(org.apache.flink.sql.parser.dql.SqlShowCreateView) SqlAlterView(org.apache.flink.sql.parser.ddl.SqlAlterView) UseModulesOperation(org.apache.flink.table.operations.UseModulesOperation) CatalogView(org.apache.flink.table.catalog.CatalogView) Catalog(org.apache.flink.table.catalog.Catalog) SqlIdentifier(org.apache.calcite.sql.SqlIdentifier) DropCatalogFunctionOperation(org.apache.flink.table.operations.ddl.DropCatalogFunctionOperation) Expander(org.apache.flink.table.planner.utils.Expander) CalciteSqlDialect(org.apache.calcite.sql.dialect.CalciteSqlDialect) ShowTablesOperation(org.apache.flink.table.operations.ShowTablesOperation) SqlDropTable(org.apache.flink.sql.parser.ddl.SqlDropTable) DescribeTableOperation(org.apache.flink.table.operations.DescribeTableOperation) SqlLoadModule(org.apache.flink.sql.parser.dql.SqlLoadModule) ShowCurrentCatalogOperation(org.apache.flink.table.operations.ShowCurrentCatalogOperation) FunctionScope(org.apache.flink.table.operations.ShowFunctionsOperation.FunctionScope) SqlCreateFunction(org.apache.flink.sql.parser.ddl.SqlCreateFunction) SqlAddJar(org.apache.flink.sql.parser.ddl.SqlAddJar) SqlCreateDatabase(org.apache.flink.sql.parser.ddl.SqlCreateDatabase) TableException(org.apache.flink.table.api.TableException) SqlTableConstraint(org.apache.flink.sql.parser.ddl.constraint.SqlTableConstraint) SqlAddPartitions(org.apache.flink.sql.parser.ddl.SqlAddPartitions) ShowFunctionsOperation(org.apache.flink.table.operations.ShowFunctionsOperation) SqlCompileAndExecutePlan(org.apache.flink.sql.parser.dml.SqlCompileAndExecutePlan) CreateDatabaseOperation(org.apache.flink.table.operations.ddl.CreateDatabaseOperation) CatalogPartitionSpec(org.apache.flink.table.catalog.CatalogPartitionSpec) SqlShowColumns(org.apache.flink.sql.parser.dql.SqlShowColumns) SqlCreateView(org.apache.flink.sql.parser.ddl.SqlCreateView) SqlStatementSet(org.apache.flink.sql.parser.dml.SqlStatementSet) SqlShowCurrentDatabase(org.apache.flink.sql.parser.dql.SqlShowCurrentDatabase) AlterPartitionPropertiesOperation(org.apache.flink.table.operations.ddl.AlterPartitionPropertiesOperation) SqlParser(org.apache.calcite.sql.parser.SqlParser) SqlShowFunctions(org.apache.flink.sql.parser.dql.SqlShowFunctions) SqlAlterTableOptions(org.apache.flink.sql.parser.ddl.SqlAlterTableOptions) TableSchemaUtils(org.apache.flink.table.utils.TableSchemaUtils) ShowPartitionsOperation(org.apache.flink.table.operations.ShowPartitionsOperation) Schema(org.apache.flink.table.api.Schema) SqlUseCatalog(org.apache.flink.sql.parser.ddl.SqlUseCatalog) SqlExecutePlan(org.apache.flink.sql.parser.dml.SqlExecutePlan) SqlShowDatabases(org.apache.flink.sql.parser.dql.SqlShowDatabases) SqlDropView(org.apache.flink.sql.parser.ddl.SqlDropView) AlterViewPropertiesOperation(org.apache.flink.table.operations.ddl.AlterViewPropertiesOperation) SqlNode(org.apache.calcite.sql.SqlNode) SqlUtil(org.apache.calcite.sql.SqlUtil) SetOperation(org.apache.flink.table.operations.command.SetOperation) RelHint(org.apache.calcite.rel.hint.RelHint) SqlAlterViewAs(org.apache.flink.sql.parser.ddl.SqlAlterViewAs) SqlAlterTableRename(org.apache.flink.sql.parser.ddl.SqlAlterTableRename) ManagedTableListener(org.apache.flink.table.catalog.ManagedTableListener) SqlDropCatalog(org.apache.flink.sql.parser.ddl.SqlDropCatalog) SqlDropFunction(org.apache.flink.sql.parser.ddl.SqlDropFunction) SqlShowCatalogs(org.apache.flink.sql.parser.dql.SqlShowCatalogs) LoadModuleOperation(org.apache.flink.table.operations.LoadModuleOperation) Operation(org.apache.flink.table.operations.Operation) AlterCatalogFunctionOperation(org.apache.flink.table.operations.ddl.AlterCatalogFunctionOperation) SqlAlterTableDropConstraint(org.apache.flink.sql.parser.ddl.SqlAlterTableDropConstraint) SqlCompilePlan(org.apache.flink.sql.parser.ddl.SqlCompilePlan) DropTempSystemFunctionOperation(org.apache.flink.table.operations.ddl.DropTempSystemFunctionOperation) ShowViewsOperation(org.apache.flink.table.operations.ShowViewsOperation) ShowDatabasesOperation(org.apache.flink.table.operations.ShowDatabasesOperation) SqlAlterTableCompact(org.apache.flink.sql.parser.ddl.SqlAlterTableCompact) FunctionLanguage(org.apache.flink.table.catalog.FunctionLanguage) StringUtils(org.apache.flink.util.StringUtils) Collectors(java.util.stream.Collectors) List(java.util.List) SqlShowModules(org.apache.flink.sql.parser.dql.SqlShowModules) ShowModulesOperation(org.apache.flink.table.operations.ShowModulesOperation) SqlRichExplain(org.apache.flink.sql.parser.dql.SqlRichExplain) SourceQueryOperation(org.apache.flink.table.operations.SourceQueryOperation) UnloadModuleOperation(org.apache.flink.table.operations.UnloadModuleOperation) ValidationException(org.apache.flink.table.api.ValidationException) DropTableOperation(org.apache.flink.table.operations.ddl.DropTableOperation) Optional(java.util.Optional) CatalogViewImpl(org.apache.flink.table.catalog.CatalogViewImpl) AlterViewAsOperation(org.apache.flink.table.operations.ddl.AlterViewAsOperation) RemoveJarOperation(org.apache.flink.table.operations.command.RemoveJarOperation) DropViewOperation(org.apache.flink.table.operations.ddl.DropViewOperation) SqlSet(org.apache.flink.sql.parser.ddl.SqlSet) CatalogManager(org.apache.flink.table.catalog.CatalogManager) SqlAlterViewProperties(org.apache.flink.sql.parser.ddl.SqlAlterViewProperties) BeginStatementSetOperation(org.apache.flink.table.operations.BeginStatementSetOperation) AddPartitionsOperation(org.apache.flink.table.operations.ddl.AddPartitionsOperation) RelRoot(org.apache.calcite.rel.RelRoot) HashMap(java.util.HashMap) AddJarOperation(org.apache.flink.table.operations.command.AddJarOperation) DropPartitionsOperation(org.apache.flink.table.operations.ddl.DropPartitionsOperation) AlterTableAddConstraintOperation(org.apache.flink.table.operations.ddl.AlterTableAddConstraintOperation) HashSet(java.util.HashSet) ExplainOperation(org.apache.flink.table.operations.ExplainOperation) ResetOperation(org.apache.flink.table.operations.command.ResetOperation) HintStrategyTable(org.apache.calcite.rel.hint.HintStrategyTable) SqlShowTables(org.apache.flink.sql.parser.dql.SqlShowTables) CatalogPartition(org.apache.flink.table.catalog.CatalogPartition) StatementSetOperation(org.apache.flink.table.operations.StatementSetOperation) SqlBeginStatementSet(org.apache.flink.sql.parser.dml.SqlBeginStatementSet) ResolvedCatalogTable(org.apache.flink.table.catalog.ResolvedCatalogTable) DropCatalogOperation(org.apache.flink.table.operations.ddl.DropCatalogOperation) ContextResolvedTable(org.apache.flink.table.catalog.ContextResolvedTable) SqlReset(org.apache.flink.sql.parser.ddl.SqlReset) SqlShowJars(org.apache.flink.sql.parser.dql.SqlShowJars) AlterTableRenameOperation(org.apache.flink.table.operations.ddl.AlterTableRenameOperation) CatalogBaseTable(org.apache.flink.table.catalog.CatalogBaseTable) SqlDialect(org.apache.calcite.sql.SqlDialect) SqlCreateCatalog(org.apache.flink.sql.parser.ddl.SqlCreateCatalog) SqlExecute(org.apache.flink.sql.parser.dml.SqlExecute) ShowCreateTableOperation(org.apache.flink.table.operations.ShowCreateTableOperation) AlterViewRenameOperation(org.apache.flink.table.operations.ddl.AlterViewRenameOperation) CreateCatalogFunctionOperation(org.apache.flink.table.operations.ddl.CreateCatalogFunctionOperation) CreateTempSystemFunctionOperation(org.apache.flink.table.operations.ddl.CreateTempSystemFunctionOperation) SqlNodeList(org.apache.calcite.sql.SqlNodeList) Collections(java.util.Collections) ShowCreateViewOperation(org.apache.flink.table.operations.ShowCreateViewOperation) CreateViewOperation(org.apache.flink.table.operations.ddl.CreateViewOperation) SqlNodeList(org.apache.calcite.sql.SqlNodeList) UnresolvedIdentifier(org.apache.flink.table.catalog.UnresolvedIdentifier) CatalogView(org.apache.flink.table.catalog.CatalogView) SqlNode(org.apache.calcite.sql.SqlNode) ObjectIdentifier(org.apache.flink.table.catalog.ObjectIdentifier)

Example 3 with CreateViewOperation

use of org.apache.flink.table.operations.ddl.CreateViewOperation in project flink by apache.

the class HiveParserDDLSemanticAnalyzer method convertCreateView.

private Operation convertCreateView(HiveParserASTNode ast) throws SemanticException {
    String[] qualTabName = HiveParserBaseSemanticAnalyzer.getQualifiedTableName((HiveParserASTNode) ast.getChild(0));
    String dbDotTable = HiveParserBaseSemanticAnalyzer.getDotName(qualTabName);
    List<FieldSchema> cols = null;
    boolean ifNotExists = false;
    boolean isAlterViewAs = false;
    String comment = null;
    HiveParserASTNode selectStmt = null;
    Map<String, String> tblProps = null;
    boolean isMaterialized = ast.getToken().getType() == HiveASTParser.TOK_CREATE_MATERIALIZED_VIEW;
    if (isMaterialized) {
        handleUnsupportedOperation("MATERIALIZED VIEW is not supported");
    }
    HiveParserStorageFormat storageFormat = new HiveParserStorageFormat(conf);
    LOG.info("Creating view " + dbDotTable + " position=" + ast.getCharPositionInLine());
    int numCh = ast.getChildCount();
    for (int num = 1; num < numCh; num++) {
        HiveParserASTNode child = (HiveParserASTNode) ast.getChild(num);
        if (storageFormat.fillStorageFormat(child)) {
            handleUnsupportedOperation("FILE FORMAT for view is not supported");
        }
        switch(child.getToken().getType()) {
            case HiveASTParser.TOK_IFNOTEXISTS:
                ifNotExists = true;
                break;
            case HiveASTParser.TOK_REWRITE_ENABLED:
                handleUnsupportedOperation("MATERIALIZED VIEW REWRITE is not supported");
                break;
            case HiveASTParser.TOK_ORREPLACE:
                handleUnsupportedOperation("CREATE OR REPLACE VIEW is not supported");
                break;
            case HiveASTParser.TOK_QUERY:
                selectStmt = child;
                break;
            case HiveASTParser.TOK_TABCOLNAME:
                cols = HiveParserBaseSemanticAnalyzer.getColumns(child);
                break;
            case HiveASTParser.TOK_TABLECOMMENT:
                comment = HiveParserBaseSemanticAnalyzer.unescapeSQLString(child.getChild(0).getText());
                break;
            case HiveASTParser.TOK_TABLEPROPERTIES:
                tblProps = getProps((HiveParserASTNode) child.getChild(0));
                break;
            case HiveASTParser.TOK_TABLEROWFORMAT:
                handleUnsupportedOperation("ROW FORMAT for view is not supported");
                break;
            case HiveASTParser.TOK_TABLESERIALIZER:
                handleUnsupportedOperation("SERDE for view is not supported");
                break;
            case HiveASTParser.TOK_TABLELOCATION:
                handleUnsupportedOperation("LOCATION for view is not supported");
                break;
            case HiveASTParser.TOK_VIEWPARTCOLS:
                handleUnsupportedOperation("PARTITION COLUMN for view is not supported");
                break;
            default:
                throw new ValidationException("Unknown AST node for CREATE/ALTER VIEW: " + child);
        }
    }
    if (ast.getToken().getType() == HiveASTParser.TOK_ALTERVIEW && ast.getChild(1).getType() == HiveASTParser.TOK_QUERY) {
        isAlterViewAs = true;
    }
    queryState.setCommandType(HiveOperation.CREATEVIEW);
    HiveParserCreateViewInfo createViewInfo = new HiveParserCreateViewInfo(dbDotTable, cols, selectStmt);
    hiveParser.analyzeCreateView(createViewInfo, context, queryState, hiveShim);
    ObjectIdentifier viewIdentifier = parseObjectIdentifier(createViewInfo.getCompoundName());
    TableSchema schema = HiveTableUtil.createTableSchema(createViewInfo.getSchema(), Collections.emptyList(), Collections.emptySet(), null);
    Map<String, String> props = new HashMap<>();
    if (isAlterViewAs) {
        CatalogBaseTable baseTable = getCatalogBaseTable(viewIdentifier);
        props.putAll(baseTable.getOptions());
        comment = baseTable.getComment();
    } else {
        if (tblProps != null) {
            props.putAll(tblProps);
        }
    }
    CatalogView catalogView = new CatalogViewImpl(createViewInfo.getOriginalText(), createViewInfo.getExpandedText(), schema, props, comment);
    if (isAlterViewAs) {
        return new AlterViewAsOperation(viewIdentifier, catalogView);
    } else {
        return new CreateViewOperation(viewIdentifier, catalogView, ifNotExists, false);
    }
}
Also used : AlterViewAsOperation(org.apache.flink.table.operations.ddl.AlterViewAsOperation) CatalogBaseTable(org.apache.flink.table.catalog.CatalogBaseTable) HiveParserASTNode(org.apache.flink.table.planner.delegation.hive.copy.HiveParserASTNode) ValidationException(org.apache.flink.table.api.ValidationException) CatalogViewImpl(org.apache.flink.table.catalog.CatalogViewImpl) TableSchema(org.apache.flink.table.api.TableSchema) HiveParserStorageFormat(org.apache.flink.table.planner.delegation.hive.copy.HiveParserStorageFormat) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) FieldSchema(org.apache.hadoop.hive.metastore.api.FieldSchema) NotNullConstraint(org.apache.flink.table.planner.delegation.hive.copy.HiveParserBaseSemanticAnalyzer.NotNullConstraint) UniqueConstraint(org.apache.flink.table.api.constraints.UniqueConstraint) CreateViewOperation(org.apache.flink.table.operations.ddl.CreateViewOperation) CatalogView(org.apache.flink.table.catalog.CatalogView) ObjectIdentifier(org.apache.flink.table.catalog.ObjectIdentifier)

Example 4 with CreateViewOperation

use of org.apache.flink.table.operations.ddl.CreateViewOperation in project zeppelin by apache.

the class Flink113Shims method parseBySqlParser.

private SqlCommandCall parseBySqlParser(Parser sqlParser, String stmt) throws Exception {
    List<Operation> operations;
    try {
        operations = sqlParser.parse(stmt);
    } catch (Throwable e) {
        throw new Exception("Invalidate SQL statement.", e);
    }
    if (operations.size() != 1) {
        throw new Exception("Only single statement is supported now.");
    }
    final SqlCommand cmd;
    String[] operands = new String[] { stmt };
    Operation operation = operations.get(0);
    if (operation instanceof CatalogSinkModifyOperation) {
        boolean overwrite = ((CatalogSinkModifyOperation) operation).isOverwrite();
        cmd = overwrite ? SqlCommand.INSERT_OVERWRITE : SqlCommand.INSERT_INTO;
    } else if (operation instanceof CreateTableOperation) {
        cmd = SqlCommand.CREATE_TABLE;
    } else if (operation instanceof DropTableOperation) {
        cmd = SqlCommand.DROP_TABLE;
    } else if (operation instanceof AlterTableOperation) {
        cmd = SqlCommand.ALTER_TABLE;
    } else if (operation instanceof CreateViewOperation) {
        cmd = SqlCommand.CREATE_VIEW;
    } else if (operation instanceof DropViewOperation) {
        cmd = SqlCommand.DROP_VIEW;
    } else if (operation instanceof CreateDatabaseOperation) {
        cmd = SqlCommand.CREATE_DATABASE;
    } else if (operation instanceof DropDatabaseOperation) {
        cmd = SqlCommand.DROP_DATABASE;
    } else if (operation instanceof AlterDatabaseOperation) {
        cmd = SqlCommand.ALTER_DATABASE;
    } else if (operation instanceof CreateCatalogOperation) {
        cmd = SqlCommand.CREATE_CATALOG;
    } else if (operation instanceof DropCatalogOperation) {
        cmd = SqlCommand.DROP_CATALOG;
    } else if (operation instanceof UseCatalogOperation) {
        cmd = SqlCommand.USE_CATALOG;
        operands = new String[] { ((UseCatalogOperation) operation).getCatalogName() };
    } else if (operation instanceof UseDatabaseOperation) {
        cmd = SqlCommand.USE;
        operands = new String[] { ((UseDatabaseOperation) operation).getDatabaseName() };
    } else if (operation instanceof ShowCatalogsOperation) {
        cmd = SqlCommand.SHOW_CATALOGS;
        operands = new String[0];
    } else if (operation instanceof ShowDatabasesOperation) {
        cmd = SqlCommand.SHOW_DATABASES;
        operands = new String[0];
    } else if (operation instanceof ShowTablesOperation) {
        cmd = SqlCommand.SHOW_TABLES;
        operands = new String[0];
    } else if (operation instanceof ShowFunctionsOperation) {
        cmd = SqlCommand.SHOW_FUNCTIONS;
        operands = new String[0];
    } else if (operation instanceof CreateCatalogFunctionOperation || operation instanceof CreateTempSystemFunctionOperation) {
        cmd = SqlCommand.CREATE_FUNCTION;
    } else if (operation instanceof DropCatalogFunctionOperation || operation instanceof DropTempSystemFunctionOperation) {
        cmd = SqlCommand.DROP_FUNCTION;
    } else if (operation instanceof AlterCatalogFunctionOperation) {
        cmd = SqlCommand.ALTER_FUNCTION;
    } else if (operation instanceof ExplainOperation) {
        cmd = SqlCommand.EXPLAIN;
    } else if (operation instanceof DescribeTableOperation) {
        cmd = SqlCommand.DESCRIBE;
        operands = new String[] { ((DescribeTableOperation) operation).getSqlIdentifier().asSerializableString() };
    } else if (operation instanceof QueryOperation) {
        cmd = SqlCommand.SELECT;
    } else {
        throw new Exception("Unknown operation: " + operation.asSummaryString());
    }
    return new SqlCommandCall(cmd, operands, stmt);
}
Also used : DropTempSystemFunctionOperation(org.apache.flink.table.operations.ddl.DropTempSystemFunctionOperation) AlterDatabaseOperation(org.apache.flink.table.operations.ddl.AlterDatabaseOperation) SqlCommandCall(org.apache.zeppelin.flink.sql.SqlCommandParser.SqlCommandCall) CreateCatalogOperation(org.apache.flink.table.operations.ddl.CreateCatalogOperation) DropCatalogFunctionOperation(org.apache.flink.table.operations.ddl.DropCatalogFunctionOperation) DropDatabaseOperation(org.apache.flink.table.operations.ddl.DropDatabaseOperation) CreateCatalogOperation(org.apache.flink.table.operations.ddl.CreateCatalogOperation) UseCatalogOperation(org.apache.flink.table.operations.UseCatalogOperation) UseDatabaseOperation(org.apache.flink.table.operations.UseDatabaseOperation) ShowCatalogsOperation(org.apache.flink.table.operations.ShowCatalogsOperation) CreateViewOperation(org.apache.flink.table.operations.ddl.CreateViewOperation) AlterDatabaseOperation(org.apache.flink.table.operations.ddl.AlterDatabaseOperation) QueryOperation(org.apache.flink.table.operations.QueryOperation) DropCatalogFunctionOperation(org.apache.flink.table.operations.ddl.DropCatalogFunctionOperation) ShowTablesOperation(org.apache.flink.table.operations.ShowTablesOperation) DescribeTableOperation(org.apache.flink.table.operations.DescribeTableOperation) AlterTableOperation(org.apache.flink.table.operations.ddl.AlterTableOperation) ShowFunctionsOperation(org.apache.flink.table.operations.ShowFunctionsOperation) CreateDatabaseOperation(org.apache.flink.table.operations.ddl.CreateDatabaseOperation) CatalogSinkModifyOperation(org.apache.flink.table.operations.CatalogSinkModifyOperation) Operation(org.apache.flink.table.operations.Operation) AlterCatalogFunctionOperation(org.apache.flink.table.operations.ddl.AlterCatalogFunctionOperation) DropTempSystemFunctionOperation(org.apache.flink.table.operations.ddl.DropTempSystemFunctionOperation) ShowDatabasesOperation(org.apache.flink.table.operations.ShowDatabasesOperation) DropTableOperation(org.apache.flink.table.operations.ddl.DropTableOperation) CreateTableOperation(org.apache.flink.table.operations.ddl.CreateTableOperation) DropViewOperation(org.apache.flink.table.operations.ddl.DropViewOperation) ExplainOperation(org.apache.flink.table.operations.ExplainOperation) DropCatalogOperation(org.apache.flink.table.operations.ddl.DropCatalogOperation) CreateCatalogFunctionOperation(org.apache.flink.table.operations.ddl.CreateCatalogFunctionOperation) CreateTempSystemFunctionOperation(org.apache.flink.table.operations.ddl.CreateTempSystemFunctionOperation) AttributedString(org.jline.utils.AttributedString) CreateTableOperation(org.apache.flink.table.operations.ddl.CreateTableOperation) CreateCatalogFunctionOperation(org.apache.flink.table.operations.ddl.CreateCatalogFunctionOperation) AlterCatalogFunctionOperation(org.apache.flink.table.operations.ddl.AlterCatalogFunctionOperation) CreateViewOperation(org.apache.flink.table.operations.ddl.CreateViewOperation) UseCatalogOperation(org.apache.flink.table.operations.UseCatalogOperation) CreateTempSystemFunctionOperation(org.apache.flink.table.operations.ddl.CreateTempSystemFunctionOperation) SqlCommand(org.apache.zeppelin.flink.sql.SqlCommandParser.SqlCommand) QueryOperation(org.apache.flink.table.operations.QueryOperation) ExplainOperation(org.apache.flink.table.operations.ExplainOperation) ShowCatalogsOperation(org.apache.flink.table.operations.ShowCatalogsOperation) DropCatalogOperation(org.apache.flink.table.operations.ddl.DropCatalogOperation) DropDatabaseOperation(org.apache.flink.table.operations.ddl.DropDatabaseOperation) CatalogSinkModifyOperation(org.apache.flink.table.operations.CatalogSinkModifyOperation) DescribeTableOperation(org.apache.flink.table.operations.DescribeTableOperation) UseDatabaseOperation(org.apache.flink.table.operations.UseDatabaseOperation) FlinkException(org.apache.flink.util.FlinkException) TableException(org.apache.flink.table.api.TableException) IOException(java.io.IOException) ShowFunctionsOperation(org.apache.flink.table.operations.ShowFunctionsOperation) AlterTableOperation(org.apache.flink.table.operations.ddl.AlterTableOperation) DropViewOperation(org.apache.flink.table.operations.ddl.DropViewOperation) DropTableOperation(org.apache.flink.table.operations.ddl.DropTableOperation) CreateDatabaseOperation(org.apache.flink.table.operations.ddl.CreateDatabaseOperation) ShowDatabasesOperation(org.apache.flink.table.operations.ShowDatabasesOperation) ShowTablesOperation(org.apache.flink.table.operations.ShowTablesOperation)

Example 5 with CreateViewOperation

use of org.apache.flink.table.operations.ddl.CreateViewOperation in project zeppelin by apache.

the class Flink114Shims method parseBySqlParser.

private SqlCommandCall parseBySqlParser(Parser sqlParser, String stmt) throws Exception {
    List<Operation> operations;
    try {
        operations = sqlParser.parse(stmt);
    } catch (Throwable e) {
        throw new Exception("Invalidate SQL statement.", e);
    }
    if (operations.size() != 1) {
        throw new Exception("Only single statement is supported now.");
    }
    final SqlCommand cmd;
    String[] operands = new String[] { stmt };
    Operation operation = operations.get(0);
    if (operation instanceof CatalogSinkModifyOperation) {
        boolean overwrite = ((CatalogSinkModifyOperation) operation).isOverwrite();
        cmd = overwrite ? SqlCommand.INSERT_OVERWRITE : SqlCommand.INSERT_INTO;
    } else if (operation instanceof CreateTableOperation) {
        cmd = SqlCommand.CREATE_TABLE;
    } else if (operation instanceof DropTableOperation) {
        cmd = SqlCommand.DROP_TABLE;
    } else if (operation instanceof AlterTableOperation) {
        cmd = SqlCommand.ALTER_TABLE;
    } else if (operation instanceof CreateViewOperation) {
        cmd = SqlCommand.CREATE_VIEW;
    } else if (operation instanceof DropViewOperation) {
        cmd = SqlCommand.DROP_VIEW;
    } else if (operation instanceof CreateDatabaseOperation) {
        cmd = SqlCommand.CREATE_DATABASE;
    } else if (operation instanceof DropDatabaseOperation) {
        cmd = SqlCommand.DROP_DATABASE;
    } else if (operation instanceof AlterDatabaseOperation) {
        cmd = SqlCommand.ALTER_DATABASE;
    } else if (operation instanceof CreateCatalogOperation) {
        cmd = SqlCommand.CREATE_CATALOG;
    } else if (operation instanceof DropCatalogOperation) {
        cmd = SqlCommand.DROP_CATALOG;
    } else if (operation instanceof UseCatalogOperation) {
        cmd = SqlCommand.USE_CATALOG;
        operands = new String[] { ((UseCatalogOperation) operation).getCatalogName() };
    } else if (operation instanceof UseDatabaseOperation) {
        cmd = SqlCommand.USE;
        operands = new String[] { ((UseDatabaseOperation) operation).getDatabaseName() };
    } else if (operation instanceof ShowCatalogsOperation) {
        cmd = SqlCommand.SHOW_CATALOGS;
        operands = new String[0];
    } else if (operation instanceof ShowDatabasesOperation) {
        cmd = SqlCommand.SHOW_DATABASES;
        operands = new String[0];
    } else if (operation instanceof ShowTablesOperation) {
        cmd = SqlCommand.SHOW_TABLES;
        operands = new String[0];
    } else if (operation instanceof ShowFunctionsOperation) {
        cmd = SqlCommand.SHOW_FUNCTIONS;
        operands = new String[0];
    } else if (operation instanceof CreateCatalogFunctionOperation || operation instanceof CreateTempSystemFunctionOperation) {
        cmd = SqlCommand.CREATE_FUNCTION;
    } else if (operation instanceof DropCatalogFunctionOperation || operation instanceof DropTempSystemFunctionOperation) {
        cmd = SqlCommand.DROP_FUNCTION;
    } else if (operation instanceof AlterCatalogFunctionOperation) {
        cmd = SqlCommand.ALTER_FUNCTION;
    } else if (operation instanceof ExplainOperation) {
        cmd = SqlCommand.EXPLAIN;
    } else if (operation instanceof DescribeTableOperation) {
        cmd = SqlCommand.DESCRIBE;
        operands = new String[] { ((DescribeTableOperation) operation).getSqlIdentifier().asSerializableString() };
    } else if (operation instanceof QueryOperation) {
        cmd = SqlCommand.SELECT;
    } else {
        throw new Exception("Unknown operation: " + operation.asSummaryString());
    }
    return new SqlCommandCall(cmd, operands, stmt);
}
Also used : DropTempSystemFunctionOperation(org.apache.flink.table.operations.ddl.DropTempSystemFunctionOperation) AlterDatabaseOperation(org.apache.flink.table.operations.ddl.AlterDatabaseOperation) SqlCommandCall(org.apache.zeppelin.flink.sql.SqlCommandParser.SqlCommandCall) CreateCatalogOperation(org.apache.flink.table.operations.ddl.CreateCatalogOperation) DropCatalogFunctionOperation(org.apache.flink.table.operations.ddl.DropCatalogFunctionOperation) DropDatabaseOperation(org.apache.flink.table.operations.ddl.DropDatabaseOperation) CreateCatalogOperation(org.apache.flink.table.operations.ddl.CreateCatalogOperation) UseCatalogOperation(org.apache.flink.table.operations.UseCatalogOperation) UseDatabaseOperation(org.apache.flink.table.operations.UseDatabaseOperation) ShowCatalogsOperation(org.apache.flink.table.operations.ShowCatalogsOperation) CreateViewOperation(org.apache.flink.table.operations.ddl.CreateViewOperation) AlterDatabaseOperation(org.apache.flink.table.operations.ddl.AlterDatabaseOperation) QueryOperation(org.apache.flink.table.operations.QueryOperation) DropCatalogFunctionOperation(org.apache.flink.table.operations.ddl.DropCatalogFunctionOperation) ShowTablesOperation(org.apache.flink.table.operations.ShowTablesOperation) DescribeTableOperation(org.apache.flink.table.operations.DescribeTableOperation) AlterTableOperation(org.apache.flink.table.operations.ddl.AlterTableOperation) ShowFunctionsOperation(org.apache.flink.table.operations.ShowFunctionsOperation) CreateDatabaseOperation(org.apache.flink.table.operations.ddl.CreateDatabaseOperation) CatalogSinkModifyOperation(org.apache.flink.table.operations.CatalogSinkModifyOperation) Operation(org.apache.flink.table.operations.Operation) AlterCatalogFunctionOperation(org.apache.flink.table.operations.ddl.AlterCatalogFunctionOperation) DropTempSystemFunctionOperation(org.apache.flink.table.operations.ddl.DropTempSystemFunctionOperation) ShowDatabasesOperation(org.apache.flink.table.operations.ShowDatabasesOperation) DropTableOperation(org.apache.flink.table.operations.ddl.DropTableOperation) CreateTableOperation(org.apache.flink.table.operations.ddl.CreateTableOperation) DropViewOperation(org.apache.flink.table.operations.ddl.DropViewOperation) ExplainOperation(org.apache.flink.table.operations.ExplainOperation) DropCatalogOperation(org.apache.flink.table.operations.ddl.DropCatalogOperation) CreateCatalogFunctionOperation(org.apache.flink.table.operations.ddl.CreateCatalogFunctionOperation) CreateTempSystemFunctionOperation(org.apache.flink.table.operations.ddl.CreateTempSystemFunctionOperation) AttributedString(org.jline.utils.AttributedString) CreateTableOperation(org.apache.flink.table.operations.ddl.CreateTableOperation) CreateCatalogFunctionOperation(org.apache.flink.table.operations.ddl.CreateCatalogFunctionOperation) AlterCatalogFunctionOperation(org.apache.flink.table.operations.ddl.AlterCatalogFunctionOperation) CreateViewOperation(org.apache.flink.table.operations.ddl.CreateViewOperation) UseCatalogOperation(org.apache.flink.table.operations.UseCatalogOperation) CreateTempSystemFunctionOperation(org.apache.flink.table.operations.ddl.CreateTempSystemFunctionOperation) SqlCommand(org.apache.zeppelin.flink.sql.SqlCommandParser.SqlCommand) QueryOperation(org.apache.flink.table.operations.QueryOperation) ExplainOperation(org.apache.flink.table.operations.ExplainOperation) ShowCatalogsOperation(org.apache.flink.table.operations.ShowCatalogsOperation) DropCatalogOperation(org.apache.flink.table.operations.ddl.DropCatalogOperation) DropDatabaseOperation(org.apache.flink.table.operations.ddl.DropDatabaseOperation) CatalogSinkModifyOperation(org.apache.flink.table.operations.CatalogSinkModifyOperation) DescribeTableOperation(org.apache.flink.table.operations.DescribeTableOperation) UseDatabaseOperation(org.apache.flink.table.operations.UseDatabaseOperation) FlinkException(org.apache.flink.util.FlinkException) TableException(org.apache.flink.table.api.TableException) IOException(java.io.IOException) ShowFunctionsOperation(org.apache.flink.table.operations.ShowFunctionsOperation) AlterTableOperation(org.apache.flink.table.operations.ddl.AlterTableOperation) DropViewOperation(org.apache.flink.table.operations.ddl.DropViewOperation) DropTableOperation(org.apache.flink.table.operations.ddl.DropTableOperation) CreateDatabaseOperation(org.apache.flink.table.operations.ddl.CreateDatabaseOperation) ShowDatabasesOperation(org.apache.flink.table.operations.ShowDatabasesOperation) ShowTablesOperation(org.apache.flink.table.operations.ShowTablesOperation)

Aggregations

TableException (org.apache.flink.table.api.TableException)5 DescribeTableOperation (org.apache.flink.table.operations.DescribeTableOperation)5 ExplainOperation (org.apache.flink.table.operations.ExplainOperation)5 Operation (org.apache.flink.table.operations.Operation)5 QueryOperation (org.apache.flink.table.operations.QueryOperation)5 ShowCatalogsOperation (org.apache.flink.table.operations.ShowCatalogsOperation)5 ShowDatabasesOperation (org.apache.flink.table.operations.ShowDatabasesOperation)5 ShowFunctionsOperation (org.apache.flink.table.operations.ShowFunctionsOperation)5 ShowTablesOperation (org.apache.flink.table.operations.ShowTablesOperation)5 UseCatalogOperation (org.apache.flink.table.operations.UseCatalogOperation)5 UseDatabaseOperation (org.apache.flink.table.operations.UseDatabaseOperation)5 CreateViewOperation (org.apache.flink.table.operations.ddl.CreateViewOperation)4 IOException (java.io.IOException)3 HashMap (java.util.HashMap)3 TableSchema (org.apache.flink.table.api.TableSchema)3 ValidationException (org.apache.flink.table.api.ValidationException)3 CatalogSinkModifyOperation (org.apache.flink.table.operations.CatalogSinkModifyOperation)3 AlterCatalogFunctionOperation (org.apache.flink.table.operations.ddl.AlterCatalogFunctionOperation)3 AlterDatabaseOperation (org.apache.flink.table.operations.ddl.AlterDatabaseOperation)3 AlterTableOperation (org.apache.flink.table.operations.ddl.AlterTableOperation)3