CTTY commented on code in PR #7359:
URL: https://github.com/apache/hudi/pull/7359#discussion_r1382291540
##########
hudi-client/hudi-java-client/src/main/java/org/apache/hudi/table/action/commit/JavaWriteHelper.java:
##########
@@ -69,17 +70,26 @@ public List<HoodieRecord<T>> deduplicateRecords(
}).collect(Collectors.groupingBy(Pair::getLeft));
final Schema schema = new Schema.Parser().parse(schemaStr);
- return keyedRecords.values().stream().map(x ->
x.stream().map(Pair::getRight).reduce((rec1, rec2) -> {
- HoodieRecord<T> reducedRecord;
- try {
- reducedRecord = merger.merge(rec1, schema, rec2, schema,
props).get().getLeft();
- } catch (IOException e) {
- throw new HoodieException(String.format("Error to merge two records,
%s, %s", rec1, rec2), e);
+ boolean sortBeforePrecombine = merger.useSortedMerge(props);
+ return keyedRecords.values().stream().map(hoodieRecords -> {
+ Stream<HoodieRecord<T>> recordStream;
+ if (sortBeforePrecombine) {
+ recordStream = hoodieRecords.stream().map(Pair::getRight).sorted(new
SortedPrecombineComparator(schema, props));
Review Comment:
Same as above. I've moved the work to a new PR: #9979
--
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]