tsreaper commented on code in PR #10607:
URL: https://github.com/apache/paimon/pull/10607#discussion_r4309875658
##########
paimon-core/src/main/java/org/apache/paimon/mergetree/compact/aggregate/FieldCollectAgg.java:
##########
@@ -130,16 +125,21 @@ private Object agg(Object accumulator, Object inputField,
boolean accumulatorHas
return inputArray;
}
- boolean removeDuplicate = distinct && equaliser != null;
Collection<Object> collection =
distinct && equaliser == null ? new LinkedHashSet<>() : new
ArrayList<>();
if (countLimit >= 0) {
- collect(collection, accumulatorArray, removeDuplicate &&
accumulatorHasDuplicate);
- collect(collection, inputArray, removeDuplicate);
+ collect(
+ collection,
+ accumulatorArray,
+ checkDuplicateUntil(accumulatorHasDuplicate, collection));
+ collect(collection, inputArray,
checkDuplicateUntil(inputHasDuplicate, collection));
return new GenericArray(collection.toArray());
} else {
- collect(collection, inputArray, removeDuplicate);
- collect(collection, accumulatorArray, removeDuplicate);
+ collect(collection, inputArray,
checkDuplicateUntil(inputHasDuplicate, collection));
+ collect(
+ collection,
+ accumulatorArray,
+ checkDuplicateUntil(accumulatorHasDuplicate, collection));
Review Comment:
I would say this is a bug in `AggregateMergeFunction`, not in this PR.
`aggregator` should be the valid aggregated value. Also note that before this
PR, we also assume that `aggregator` has distinct values in `FieldCollectAgg`,
so this problem is not introduced by this PR.
--
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]