linliu-code commented on code in PR #12327:
URL: https://github.com/apache/hudi/pull/12327#discussion_r1861312247


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/EightToSevenDowngradeHandler.java:
##########
@@ -168,6 +156,168 @@ private static void 
downgradePartitionFields(HoodieWriteConfig config,
     }
   }
 
+  static void unsetInitialVersion(HoodieTableConfig tableConfig, 
Map<ConfigProperty, String> tablePropsToAdd) {
+    tableConfig.getProps().remove(HoodieTableConfig.INITIAL_VERSION.key());
+  }
+
+  static void unsetRecordMergeMode(HoodieTableConfig tableConfig, 
Map<ConfigProperty, String> tablePropsToAdd) {
+    Triple<RecordMergeMode, String, String> mergingConfigs =
+        
HoodieTableConfig.inferCorrectMergingBehavior(tableConfig.getRecordMergeMode(), 
tableConfig.getPayloadClass(), tableConfig.getRecordMergeStrategyId());
+    if (StringUtils.nonEmpty(mergingConfigs.getMiddle())) {
+      tablePropsToAdd.put(HoodieTableConfig.PAYLOAD_CLASS_NAME, 
mergingConfigs.getMiddle());
+    }
+    if (StringUtils.nonEmpty(mergingConfigs.getRight())) {
+      tablePropsToAdd.put(HoodieTableConfig.RECORD_MERGE_STRATEGY_ID, 
mergingConfigs.getRight());
+    }
+    tableConfig.getProps().remove(HoodieTableConfig.RECORD_MERGE_MODE.key());
+  }

Review Comment:
   As we discussed offline, for a MOR table with OverwriteWithLatestPayload 
from version 7 to version 8, its payload class will be updated to 
`DefaultHoodieRecordPayload`. If we later decide to downgrade it, the payload 
class will not be downgraded back to `OverwriteWithLatestPayload` since we 
cannot record its original payload class.



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