bowenli86 commented on a change in pull request #10410: 
[FLINK-14692][table]support rename/alter table in tableEnvironment in both 
flink/blink planner
URL: https://github.com/apache/flink/pull/10410#discussion_r353922475
 
 

 ##########
 File path: 
flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/operations/SqlToOperationConverter.java
 ##########
 @@ -179,6 +184,37 @@ private Operation convertDropTable(SqlDropTable 
sqlDropTable) {
                return new DropTableOperation(identifier, 
sqlDropTable.getIfExists());
        }
 
+       /** convert ALTER TABLE statement. */
+       private Operation convertAlterTable(SqlAlterTable sqlAlterTable) {
+               UnresolvedIdentifier unresolvedIdentifier = 
UnresolvedIdentifier.of(sqlAlterTable.fullTableName());
+               ObjectIdentifier tableIdentifier = 
catalogManager.qualifyIdentifier(unresolvedIdentifier);
+               ObjectIdentifier newTableIdentifer = null;
+               Map<String, String> properties = new HashMap<>();
+               CatalogTable catalogTable = null;
+               if (sqlAlterTable.isRename()) {
+                       UnresolvedIdentifier newUnresolvedIdentifier = 
UnresolvedIdentifier.of(sqlAlterTable.fullNewTableName());
+                       newTableIdentifer = 
catalogManager.qualifyIdentifier(newUnresolvedIdentifier);
+               } else {
+                       Optional<CatalogManager.TableLookupResult> 
optionalCatalogTable = catalogManager.getTable(tableIdentifier);
+                       if (optionalCatalogTable.isPresent() && 
!optionalCatalogTable.get().isTemporary()) {
+                               CatalogTable originalCatalogTable = 
(CatalogTable) optionalCatalogTable.get().getTable();
+                               
properties.putAll(originalCatalogTable.getProperties());
+                               
sqlAlterTable.getPropertyList().getList().forEach(p ->
+                                                               
properties.put(((SqlTableOption) p).getKeyString().toLowerCase(),
 
 Review comment:
   do we force users to have lower case keys?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to