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


##########
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:
   first priority is to use keygen class if it is there and then use keygen 
type. Removed the double invocation.



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