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


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/SevenToEightUpgradeHandler.java:
##########
@@ -120,4 +125,22 @@ private static void 
upgradePartitionFields(HoodieWriteConfig config, HoodieTable
       tablePropsToAdd.put(HoodieTableConfig.PARTITION_FIELDS, 
partitionPathField);
     }
   }
+
+  private static void upgradeMergeMode(HoodieWriteConfig config, 
HoodieTableConfig tableConfig, Map<ConfigProperty, String> tablePropsToAdd) {
+    if (tableConfig.getPayloadClass() != null
+        && 
tableConfig.getPayloadClass().equals(OverwriteWithLatestAvroPayload.class.getName()))
 {
+      if (HoodieTableType.COPY_ON_WRITE == tableConfig.getTableType()) {
+        tablePropsToAdd.put(
+            HoodieTableConfig.PAYLOAD_CLASS_NAME,
+            DefaultHoodieRecordPayload.class.getName());
+        tablePropsToAdd.put(
+            HoodieTableConfig.RECORD_MERGE_MODE,
+            RecordMergeMode.EVENT_TIME_ORDERING.name());
+      } else {
+        tablePropsToAdd.put(
+            HoodieTableConfig.RECORD_MERGE_MODE,
+            RecordMergeMode.COMMIT_TIME_ORDERING.name());
+      }

Review Comment:
   The branching is incorrect.  For MOR table, we need to set 
`EVENT_TIME_ORDERING` as the merge mode if `OverwriteWithLatestAvroPayload` is 
the payload class used.  For COW table, set `COMMIT_TIME_ORDERING` as the merge 
mode if `OverwriteWithLatestAvroPayload` is used.



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