-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-36993][table] Support converting ALTER MATERIALIZED TABLE AS n…
…ode to operation
- Loading branch information
Showing
5 changed files
with
461 additions
and
15 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
...ache/flink/table/operations/materializedtable/AlterMaterializedTableAsQueryOperation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.table.operations.materializedtable; | ||
|
||
import org.apache.flink.annotation.Internal; | ||
import org.apache.flink.table.api.internal.TableResultInternal; | ||
import org.apache.flink.table.catalog.CatalogMaterializedTable; | ||
import org.apache.flink.table.catalog.ObjectIdentifier; | ||
import org.apache.flink.table.catalog.TableChange; | ||
import org.apache.flink.table.operations.Operation; | ||
import org.apache.flink.table.operations.OperationUtils; | ||
|
||
import java.util.Collections; | ||
import java.util.LinkedHashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** Operation to describe an ALTER MATERIALIZED TABLE AS query operation. */ | ||
@Internal | ||
public class AlterMaterializedTableAsQueryOperation extends AlterMaterializedTableOperation { | ||
|
||
private final List<TableChange> columnChanges; | ||
|
||
private final TableChange definitionQueryChange; | ||
|
||
private final CatalogMaterializedTable newMaterializedTable; | ||
|
||
public AlterMaterializedTableAsQueryOperation( | ||
ObjectIdentifier tableIdentifier, | ||
List<TableChange> columnChanges, | ||
TableChange definitionQueryChange, | ||
CatalogMaterializedTable newMaterializedTable) { | ||
super(tableIdentifier); | ||
this.columnChanges = columnChanges; | ||
this.definitionQueryChange = definitionQueryChange; | ||
this.newMaterializedTable = newMaterializedTable; | ||
} | ||
|
||
public List<TableChange> getColumnChanges() { | ||
return columnChanges; | ||
} | ||
|
||
public TableChange getDefinitionQueryChange() { | ||
return definitionQueryChange; | ||
} | ||
|
||
public CatalogMaterializedTable getNewMaterializedTable() { | ||
return newMaterializedTable; | ||
} | ||
|
||
@Override | ||
public TableResultInternal execute(Context ctx) { | ||
throw new UnsupportedOperationException( | ||
"AlterMaterializedTableAsQueryOperation doesn't support ExecutableOperation yet."); | ||
} | ||
|
||
@Override | ||
public String asSummaryString() { | ||
Map<String, Object> params = new LinkedHashMap<>(); | ||
params.put("identifier", tableIdentifier); | ||
params.put("columnChanges", columnChanges); | ||
params.put("definitionQueryChange", definitionQueryChange); | ||
|
||
return OperationUtils.formatWithChildren( | ||
"ALTER MATERIALIZED TABLE", | ||
params, | ||
Collections.emptyList(), | ||
Operation::asSummaryString); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.