yihua commented on code in PR #13046:
URL: https://github.com/apache/hudi/pull/13046#discussion_r2019615082
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/EightToSevenDowngradeHandler.java:
##########
@@ -161,19 +166,27 @@ static void unsetInitialVersion(HoodieTableConfig
tableConfig, Map<ConfigPropert
tableConfig.getProps().remove(HoodieTableConfig.INITIAL_VERSION.key());
}
- static void unsetRecordMergeMode(HoodieTableConfig tableConfig,
Map<ConfigProperty, String> tablePropsToAdd) {
- Triple<RecordMergeMode, String, String> mergingConfigs =
- HoodieTableConfig.inferCorrectMergingBehavior(
- tableConfig.getRecordMergeMode(), tableConfig.getPayloadClass(),
- tableConfig.getRecordMergeStrategyId(),
tableConfig.getPreCombineField(),
- tableConfig.getTableVersion());
- 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());
+ static List<ConfigProperty> unsetRecordMergeMode(HoodieWriteConfig config,
HoodieTableConfig tableConfig, Map<ConfigProperty, String> tablePropsToAdd) {
+ String payloadClass = tableConfig.getPayloadClass();
+ if (StringUtils.isNullOrEmpty(payloadClass)) {
+ RecordMergeMode mergeMode = tableConfig.getRecordMergeMode();
+ switch (mergeMode) {
+ case EVENT_TIME_ORDERING:
+ tablePropsToAdd.put(HoodieTableConfig.PAYLOAD_CLASS_NAME,
DefaultHoodieRecordPayload.class.getName());
+ break;
+ case COMMIT_TIME_ORDERING:
+ tablePropsToAdd.put(HoodieTableConfig.PAYLOAD_CLASS_NAME,
OverwriteWithLatestAvroPayload.class.getName());
+ break;
+ case CUSTOM:
+ throw new HoodieUpgradeDowngradeException("Custom payload class must
be available for downgrading custom merge mode");
+ default:
+ throw new HoodieUpgradeDowngradeException("Downgrade is not handled
for " + mergeMode);
+ }
}
- tableConfig.getProps().remove(HoodieTableConfig.RECORD_MERGE_MODE.key());
+ tablePropsToAdd.put(
+ HoodieTableConfig.RECORD_MERGE_STRATEGY_ID,
Review Comment:
Let's make sure the config key is the same as 0.14 release.
--
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]