You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "prashantwason (via GitHub)" <gi...@apache.org> on 2023/04/20 07:00:08 UTC

[GitHub] [hudi] prashantwason commented on a diff in pull request #8492: [HUDI-6096] Update table name in hoodie.properties from the write config when it is changed.

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


##########
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:
   In that case, there is not much use of table name in the HoodieWriteConfig. 
   1. If any code path depends on table name from HoodieWriteConfig then that would be using the wrong table name (different from hoodie.properties)
   2. If no code path is using table name from HoodieWriteConfig then we may remove it
   3. The writers seems to be using the table name from HoodieWriteConfig and readers from hoodie.properties. There is a disconnect here.
   
   



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org