Search in sources :

Example 1 with RichSqlInsert

use of org.apache.flink.sql.parser.dml.RichSqlInsert in project flink by apache.

the class SqlToOperationConverter method convertRichExplain.

/**
 * Convert RICH EXPLAIN statement.
 */
private Operation convertRichExplain(SqlRichExplain sqlExplain) {
    SqlNode sqlNode = sqlExplain.getStatement();
    Operation operation;
    if (sqlNode instanceof RichSqlInsert) {
        operation = convertSqlInsert((RichSqlInsert) sqlNode);
    } else if (sqlNode instanceof SqlStatementSet) {
        operation = convertSqlStatementSet((SqlStatementSet) sqlNode);
    } else if (sqlNode.getKind().belongsTo(SqlKind.QUERY)) {
        operation = convertSqlQuery(sqlExplain.getStatement());
    } else {
        throw new ValidationException(String.format("EXPLAIN statement doesn't support %s", sqlNode.getKind()));
    }
    return new ExplainOperation(operation, sqlExplain.getExplainDetails());
}
Also used : ExplainOperation(org.apache.flink.table.operations.ExplainOperation) ValidationException(org.apache.flink.table.api.ValidationException) SqlStatementSet(org.apache.flink.sql.parser.dml.SqlStatementSet) 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) CreateViewOperation(org.apache.flink.table.operations.ddl.CreateViewOperation) ShowJarsOperation(org.apache.flink.table.operations.command.ShowJarsOperation) AlterDatabaseOperation(org.apache.flink.table.operations.ddl.AlterDatabaseOperation) QueryOperation(org.apache.flink.table.operations.QueryOperation) CompileAndExecutePlanOperation(org.apache.flink.table.operations.CompileAndExecutePlanOperation) EndStatementSetOperation(org.apache.flink.table.operations.EndStatementSetOperation) 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) ShowFunctionsOperation(org.apache.flink.table.operations.ShowFunctionsOperation) CreateDatabaseOperation(org.apache.flink.table.operations.ddl.CreateDatabaseOperation) AlterPartitionPropertiesOperation(org.apache.flink.table.operations.ddl.AlterPartitionPropertiesOperation) ShowPartitionsOperation(org.apache.flink.table.operations.ShowPartitionsOperation) AlterViewPropertiesOperation(org.apache.flink.table.operations.ddl.AlterViewPropertiesOperation) SetOperation(org.apache.flink.table.operations.command.SetOperation) 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) ShowViewsOperation(org.apache.flink.table.operations.ShowViewsOperation) ShowDatabasesOperation(org.apache.flink.table.operations.ShowDatabasesOperation) 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) RemoveJarOperation(org.apache.flink.table.operations.command.RemoveJarOperation) DropViewOperation(org.apache.flink.table.operations.ddl.DropViewOperation) BeginStatementSetOperation(org.apache.flink.table.operations.BeginStatementSetOperation) AddPartitionsOperation(org.apache.flink.table.operations.ddl.AddPartitionsOperation) AddJarOperation(org.apache.flink.table.operations.command.AddJarOperation) DropPartitionsOperation(org.apache.flink.table.operations.ddl.DropPartitionsOperation) AlterTableAddConstraintOperation(org.apache.flink.table.operations.ddl.AlterTableAddConstraintOperation) ExplainOperation(org.apache.flink.table.operations.ExplainOperation) ResetOperation(org.apache.flink.table.operations.command.ResetOperation) 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) RichSqlInsert(org.apache.flink.sql.parser.dml.RichSqlInsert) SqlNode(org.apache.calcite.sql.SqlNode)

Aggregations

SqlNode (org.apache.calcite.sql.SqlNode)1 RichSqlInsert (org.apache.flink.sql.parser.dml.RichSqlInsert)1 SqlStatementSet (org.apache.flink.sql.parser.dml.SqlStatementSet)1 ValidationException (org.apache.flink.table.api.ValidationException)1 BeginStatementSetOperation (org.apache.flink.table.operations.BeginStatementSetOperation)1 CompileAndExecutePlanOperation (org.apache.flink.table.operations.CompileAndExecutePlanOperation)1 DescribeTableOperation (org.apache.flink.table.operations.DescribeTableOperation)1 EndStatementSetOperation (org.apache.flink.table.operations.EndStatementSetOperation)1 ExplainOperation (org.apache.flink.table.operations.ExplainOperation)1 LoadModuleOperation (org.apache.flink.table.operations.LoadModuleOperation)1 ModifyOperation (org.apache.flink.table.operations.ModifyOperation)1 Operation (org.apache.flink.table.operations.Operation)1 QueryOperation (org.apache.flink.table.operations.QueryOperation)1 ShowCatalogsOperation (org.apache.flink.table.operations.ShowCatalogsOperation)1 ShowColumnsOperation (org.apache.flink.table.operations.ShowColumnsOperation)1 ShowCreateTableOperation (org.apache.flink.table.operations.ShowCreateTableOperation)1 ShowCreateViewOperation (org.apache.flink.table.operations.ShowCreateViewOperation)1 ShowCurrentCatalogOperation (org.apache.flink.table.operations.ShowCurrentCatalogOperation)1 ShowCurrentDatabaseOperation (org.apache.flink.table.operations.ShowCurrentDatabaseOperation)1 ShowDatabasesOperation (org.apache.flink.table.operations.ShowDatabasesOperation)1