linliu-code commented on code in PR #13498:
URL: https://github.com/apache/hudi/pull/13498#discussion_r2198066162
##########
hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableConfig.java:
##########
@@ -849,16 +869,25 @@ public static Triple<RecordMergeMode, String, String>
inferCorrectMergingBehavio
return Triple.of(inferredRecordMergeMode, inferredPayloadClassName,
inferredRecordMergeStrategyId);
}
- public static RecordMergeMode inferRecordMergeModeFromPayloadClass(String
payloadClassName) {
+ public static RecordMergeMode inferRecordMergeModeFromPayloadClass(String
payloadClassName, HoodieTableVersion tableVersion) {
if (isNullOrEmpty(payloadClassName)) {
return null;
}
+ // TODO: make this only for version > 8 after upgrade table version.
+ if (tableVersion.greaterThanOrEquals(HoodieTableVersion.EIGHT)) {
+ if (PartialUpdateAvroPayload.class.getName().equals(payloadClassName)
+ ||
PostgresDebeziumAvroPayload.class.getName().equals(payloadClassName)) {
+ return EVENT_TIME_ORDERING;
+ } else if
(OverwriteNonDefaultsWithLatestAvroPayload.class.getName().equals(payloadClassName)
+ || AWSDmsAvroPayload.class.getName().equals(payloadClassName)) {
+ return COMMIT_TIME_ORDERING;
+ }
+ }
Review Comment:
No needed. We don't need to differentiate them by table versions.
##########
hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableConfig.java:
##########
@@ -871,16 +892,29 @@ public static Triple<RecordMergeMode, String, String>
inferCorrectMergingBehavio
return Triple.of(inferredRecordMergeMode, inferredPayloadClassName,
inferredRecordMergeStrategyId);
}
- public static RecordMergeMode inferRecordMergeModeFromPayloadClass(String
payloadClassName) {
+ public static RecordMergeMode inferRecordMergeModeFromPayloadClass(String
payloadClassName, HoodieTableVersion tableVersion) {
if (isNullOrEmpty(payloadClassName)) {
return null;
}
- if (DefaultHoodieRecordPayload.class.getName().equals(payloadClassName)
- || EventTimeAvroPayload.class.getName().equals(payloadClassName)) {
- // DefaultHoodieRecordPayload and EventTimeAvroPayload match with
EVENT_TIME_ORDERING.
+ // Special handling for table version 9.
+ // Due to HUDI RFC-97, more payload classes are mapped to merge mode in
table version 9.
+ // Currently the table version 9 is not added yet, so we use >= 8
temporarily.
+ // TODO: We need to change comparison to == 9, instead of >= 8 when tablee
version 9 has been enabled.
+ if (tableVersion.versionCode() >= HoodieTableVersion.EIGHT.versionCode()) {
+ if (PartialUpdateAvroPayload.class.getName().equals(payloadClassName)
+ ||
PostgresDebeziumAvroPayload.class.getName().equals(payloadClassName)
+ || EventTimeAvroPayload.class.getName().equals(payloadClassName)) {
+ return EVENT_TIME_ORDERING;
+ } else if
(OverwriteNonDefaultsWithLatestAvroPayload.class.getName().equals(payloadClassName)
+ || AWSDmsAvroPayload.class.getName().equals(payloadClassName)) {
+ return COMMIT_TIME_ORDERING;
+ }
+ }
+
+ // For general case.
Review Comment:
Done.
--
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]