You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/12/05 02:51:58 UTC

[GitHub] [flink] zjuwangg commented on a change in pull request #10410: [FLINK-14692][table]support rename/alter table in tableEnvironment in both flink/blink planner

zjuwangg 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_r354088644
 
 

 ##########
 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:
   That's a very good question. Now the create table converter will lower the properties too. And I talked with @danny0405  offline and agreed to change the current behavior, so I create a issue to track [FLINK-15061](https://issues.apache.org/jira/browse/FLINK-15061). I'll fix this problem in another PR.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services