danny0405 commented on code in PR #8492:
URL: https://github.com/apache/hudi/pull/8492#discussion_r1170797350


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieWriteClient.java:
##########
@@ -1193,6 +1194,17 @@ protected final HoodieTable initTable(WriteOperationType 
operationType, Option<S
       default:
     }
 
+    // Keep hoodie.properties updated from write config
+    HoodieTableConfig tableConfig = metaClient.getTableConfig();
+    if (!StringUtils.isNullOrEmpty(config.getTableName()) && 
!config.getTableName().equals(tableConfig.getTableName())) {
+      LOG.info("Table name for dataset has changed from " + 
tableConfig.getTableName() + " to " + config.getTableName());
+      tableConfig.setTableName(config.getTableName());
+      HoodieTableConfig.update(metaClient.getFs(), new 
Path(metaClient.getMetaPath()), tableConfig.getProps());

Review Comment:
   Usually table config should have high priority because it is shared by all 
the writers, not sure whether we should allow the change of table name by just 
a change of write config.
   
   A more general solution for table name changing is from the SQL `ALTER 
TABLE` statement.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to