linliu-code commented on code in PR #13615:
URL: https://github.com/apache/hudi/pull/13615#discussion_r2265039780
##########
hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableConfig.java:
##########
@@ -801,19 +841,91 @@ public String getPayloadClass() {
return HoodieRecordPayload.getPayloadClassName(this);
}
+ public String getLegacyPayloadClass() {
+ return getStringOrDefault(LEGACY_PAYLOAD_CLASS_NAME, "");
+ }
+
public String getRecordMergeStrategyId() {
return getString(RECORD_MERGE_STRATEGY_ID);
}
+ /**
+ * Handle table config creation logic when creating a table for Table
Version 9,
+ * which is based on the logic of table version < 9, and then tuned for
version 9 logic.
+ * This approach fits the same behavior of upgrade from 8 to 9.
+ */
+ public static Map<String, String>
inferMergingConfigsForVersion9(RecordMergeMode recordMergeMode,
+ String
payloadClassName,
+ String
recordMergeStrategyId,
+ String
orderingFieldName,
+
HoodieTableVersion tableVersion) {
+ Map<String, String> reconciledConfigs = new HashMap<>();
+ if (tableVersion.versionCode() != HoodieTableVersion.NINE.versionCode()) {
+ return reconciledConfigs;
+ }
+
+ // Step 1: Infer merging configs based on input information.
+ // This step is important since it provides the same configs before we do
table upgrade.
+ // Then additional logic for table version 9 could be verified.
+ Triple<RecordMergeMode, String, String> inferredConfigs =
inferBasicMergingBehavior(
+ recordMergeMode, payloadClassName, recordMergeStrategyId,
orderingFieldName, tableVersion);
+ recordMergeMode = inferredConfigs.getLeft();
+ recordMergeStrategyId = inferredConfigs.getRight();
+
+ // Step 2: Handle Version 9 specific logic.
+ // CASE 1: For tables using MERGE MODE, or CUSTOM mergers.
+ // NOTE: Payload class should NOT be set for this case.
+ if (StringUtils.isNullOrEmpty(payloadClassName)) {
+ reconciledConfigs.put(RECORD_MERGE_MODE.key(), recordMergeMode.name());
+ reconciledConfigs.put(RECORD_MERGE_STRATEGY_ID.key(),
recordMergeStrategyId);
+ } else {
+ // For tables using payload classes.
+ // CASE 2: Custom payload class. We set these properties explicitly.
+ if (!PAYLOADS_UNDER_DEPRECATION.contains(payloadClassName)) {
+ reconciledConfigs.put(RECORD_MERGE_MODE.key(), CUSTOM.toString());
+ reconciledConfigs.put(PAYLOAD_CLASS_NAME.key(), payloadClassName);
Review Comment:
payload class is used for custom payload class use case
--
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]