lirui-apache commented on a change in pull request #12108:
URL: https://github.com/apache/flink/pull/12108#discussion_r426145775
##########
File path:
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalog.java
##########
@@ -484,18 +512,24 @@ public void alterTable(ObjectPath tablePath,
CatalogBaseTable newCatalogTable, b
existingTable.getClass().getName(),
newCatalogTable.getClass().getName()));
}
- Table newTable = instantiateHiveTable(tablePath,
newCatalogTable, hiveConf);
-
- // client.alter_table() requires a valid location
- // thus, if new table doesn't have that, it reuses location of
the old table
- if (!newTable.getSd().isSetLocation()) {
-
newTable.getSd().setLocation(hiveTable.getSd().getLocation());
+ boolean isGeneric = isGenericForGet(hiveTable.getParameters());
+ if (isGeneric) {
+ hiveTable = alterTableViaCatalogBaseTable(tablePath,
newCatalogTable, hiveTable);
+ } else {
+ AlterTableOp op =
extractAlterTableOp(newCatalogTable.getOptions());
Review comment:
I can extract some methods to the util class, but it's difficulty to
move all of them. The `alterTableViaProperties` needs to access the HMS client
to do the cascade ALTER COLUMNS. So I don't think we should make it static.
----------------------------------------------------------------
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]