Search in sources :

Example 1 with ResetOperation

use of org.apache.flink.table.operations.command.ResetOperation in project flink by apache.

the class SqlToOperationConverterTest method testReset.

@Test
public void testReset() {
    Operation operation1 = parse("RESET", SqlDialect.DEFAULT);
    assertThat(operation1).isInstanceOf(ResetOperation.class);
    assertThat(((ResetOperation) operation1).getKey()).isNotPresent();
    Operation operation2 = parse("RESET 'test-key'", SqlDialect.DEFAULT);
    assertThat(operation2).isInstanceOf(ResetOperation.class);
    assertThat(((ResetOperation) operation2).getKey()).isPresent();
    assertThat(((ResetOperation) operation2).getKey()).hasValue("test-key");
}
Also used : ResetOperation(org.apache.flink.table.operations.command.ResetOperation) OperationMatchers.isCreateTableOperation(org.apache.flink.table.planner.utils.OperationMatchers.isCreateTableOperation) DropDatabaseOperation(org.apache.flink.table.operations.ddl.DropDatabaseOperation) SinkModifyOperation(org.apache.flink.table.operations.SinkModifyOperation) AlterTableOptionsOperation(org.apache.flink.table.operations.ddl.AlterTableOptionsOperation) AlterTableDropConstraintOperation(org.apache.flink.table.operations.ddl.AlterTableDropConstraintOperation) UseCatalogOperation(org.apache.flink.table.operations.UseCatalogOperation) UseDatabaseOperation(org.apache.flink.table.operations.UseDatabaseOperation) 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) EndStatementSetOperation(org.apache.flink.table.operations.EndStatementSetOperation) UseModulesOperation(org.apache.flink.table.operations.UseModulesOperation) ShowFunctionsOperation(org.apache.flink.table.operations.ShowFunctionsOperation) CreateDatabaseOperation(org.apache.flink.table.operations.ddl.CreateDatabaseOperation) SetOperation(org.apache.flink.table.operations.command.SetOperation) LoadModuleOperation(org.apache.flink.table.operations.LoadModuleOperation) Operation(org.apache.flink.table.operations.Operation) ShowModulesOperation(org.apache.flink.table.operations.ShowModulesOperation) SourceQueryOperation(org.apache.flink.table.operations.SourceQueryOperation) UnloadModuleOperation(org.apache.flink.table.operations.UnloadModuleOperation) CreateTableOperation(org.apache.flink.table.operations.ddl.CreateTableOperation) RemoveJarOperation(org.apache.flink.table.operations.command.RemoveJarOperation) BeginStatementSetOperation(org.apache.flink.table.operations.BeginStatementSetOperation) AddJarOperation(org.apache.flink.table.operations.command.AddJarOperation) 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) AlterTableRenameOperation(org.apache.flink.table.operations.ddl.AlterTableRenameOperation) Test(org.junit.Test)

Example 2 with ResetOperation

use of org.apache.flink.table.operations.command.ResetOperation in project flink by apache.

the class ResetOperationParseStrategy method convert.

@Override
public Operation convert(String statement) {
    Matcher matcher = pattern.matcher(statement.trim());
    String key;
    if (matcher.find()) {
        key = matcher.group("key");
    } else {
        throw new TableException(String.format("Failed to convert the statement to RESET operation: %s.", statement));
    }
    return new ResetOperation(key);
}
Also used : ResetOperation(org.apache.flink.table.operations.command.ResetOperation) TableException(org.apache.flink.table.api.TableException) Matcher(java.util.regex.Matcher)

Aggregations

ResetOperation (org.apache.flink.table.operations.command.ResetOperation)2 Matcher (java.util.regex.Matcher)1 TableException (org.apache.flink.table.api.TableException)1 BeginStatementSetOperation (org.apache.flink.table.operations.BeginStatementSetOperation)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 Operation (org.apache.flink.table.operations.Operation)1 QueryOperation (org.apache.flink.table.operations.QueryOperation)1 ShowFunctionsOperation (org.apache.flink.table.operations.ShowFunctionsOperation)1 ShowModulesOperation (org.apache.flink.table.operations.ShowModulesOperation)1 SinkModifyOperation (org.apache.flink.table.operations.SinkModifyOperation)1 SourceQueryOperation (org.apache.flink.table.operations.SourceQueryOperation)1 StatementSetOperation (org.apache.flink.table.operations.StatementSetOperation)1 UnloadModuleOperation (org.apache.flink.table.operations.UnloadModuleOperation)1 UseCatalogOperation (org.apache.flink.table.operations.UseCatalogOperation)1 UseDatabaseOperation (org.apache.flink.table.operations.UseDatabaseOperation)1 UseModulesOperation (org.apache.flink.table.operations.UseModulesOperation)1 AddJarOperation (org.apache.flink.table.operations.command.AddJarOperation)1 RemoveJarOperation (org.apache.flink.table.operations.command.RemoveJarOperation)1