danny0405 commented on code in PR #7281:
URL: https://github.com/apache/hudi/pull/7281#discussion_r1095433428
##########
hudi-common/src/main/java/org/apache/hudi/common/table/view/AbstractTableFileSystemView.java:
##########
@@ -244,7 +244,9 @@ private void resetFileGroupsReplaced(HoodieTimeline
timeline) {
}
});
- Map<HoodieFileGroupId, HoodieInstant> replacedFileGroups =
resultStream.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+ // Duplicate key error when insert_overwrite same partition in multi
writer, distinct HoodieFileGroupId,If repeated, save instant with the larger
timestamp
+ Map<HoodieFileGroupId, HoodieInstant> replacedFileGroups =
resultStream.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
+ (instance1, instance2) -> instance1.compareTo(instance2) < 0 ?
instance2 : instance1));
resetReplacedFileGroups(replacedFileGroups);
Review Comment:
It is better to use `HoodieTimeline.compareTimestamps` for comparing the
instants..
--
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]