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


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/EightToSevenDowngradeHandler.java:
##########
@@ -168,6 +135,43 @@ private static void 
downgradePartitionFields(HoodieWriteConfig config,
     }
   }
 
+  static void unsetInitialVersion(HoodieWriteConfig config, HoodieTableConfig 
tableConfig, Map<ConfigProperty, String> tablePropsToAdd) {
+    tableConfig.getProps().remove(HoodieTableConfig.INITIAL_VERSION.key());
+  }
+
+  static void unsetRecordMergeMode(HoodieWriteConfig config, HoodieTableConfig 
tableConfig, Map<ConfigProperty, String> tablePropsToAdd) {
+    Triple<RecordMergeMode, String, String> mergingConfigs =
+        
HoodieTableConfig.inferCorrectMergingBehavior(config.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());
+  }
+
+  static void downgradeBootstrapIndexType(HoodieWriteConfig config,
+                                          HoodieTableConfig tableConfig,
+                                          Map<ConfigProperty, String> 
tablePropsToAdd) {
+    String bootstrapIndexClassName = 
BootstrapIndexType.getBootstrapIndexClassName(config);
+    if (StringUtils.nonEmpty(bootstrapIndexClassName)) {
+      tablePropsToAdd.put(HoodieTableConfig.BOOTSTRAP_INDEX_CLASS_NAME, 
bootstrapIndexClassName);
+    }
+    
tableConfig.getProps().remove(HoodieTableConfig.BOOTSTRAP_INDEX_TYPE.key());
+  }
+
+  static void downgradeKeyGeneratorType(HoodieWriteConfig config,
+                                        HoodieTableConfig tableConfig,
+                                        Map<ConfigProperty, String> 
tablePropsToAdd) {
+    String keyGenerator = KeyGeneratorType.getKeyGeneratorClassName(config);
+    if (StringUtils.nonEmpty(keyGenerator)) {
+      keyGenerator = KeyGeneratorType.getKeyGeneratorClassName(config);

Review Comment:
   should we infer the key gen class name from key gen type?



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