yihua commented on code in PR #19426:
URL: https://github.com/apache/hudi/pull/19426#discussion_r3688069198


##########
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveSyncTool.java:
##########
@@ -239,9 +240,9 @@ protected void syncHoodieTable(String tableName, boolean 
useRealtimeInputFormat,
     log.info("Trying to sync hoodie table {} with base path {} of type {}", 
tableName, syncClient.getBasePath(), syncClient.getTableType());
 
     final boolean tableExists = syncClient.tableExists(tableName);
-    // if table exists and location of the metastore table doesn't match the 
hoodie base path, recreate the table
-    if (tableExists && 
!FSUtils.comparePathsWithoutScheme(syncClient.getBasePath(), 
syncClient.getTableLocation(tableName))) {
-      log.info("basepath is updated for the table {}", tableName);
+    // recreate the table if it exists and either its metastore location no 
longer matches the hoodie base path,
+    // or a full recreate was explicitly requested
+    if (tableExists && shouldRecreateTable(tableName)) {

Review Comment:
   Fixed — added `syncClient.updateHoodieWriterVersion(tableName)` to 
`recreateAndSyncHiveTable`.



##########
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveSyncTool.java:
##########
@@ -360,6 +361,22 @@ protected boolean shouldRecreateAndSyncTable() {
     return config.getBooleanOrDefault(RECREATE_HIVE_TABLE_ON_ERROR);
   }
 
+  /**
+   * Whether the metastore table (assumed to already exist) should be dropped 
and recreated, either because a
+   * full recreate was explicitly requested, or because its stored location no 
longer matches the hoodie base path.
+   */
+  private boolean shouldRecreateTable(String tableName) {

Review Comment:
   Done, renamed to `shouldRecreateTableBeforeSync`.



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