QuakeWang commented on code in PR #8272:
URL: https://github.com/apache/paimon/pull/8272#discussion_r3445581852
##########
paimon-core/src/main/java/org/apache/paimon/mergetree/compact/aggregate/FieldNestedUpdateAgg.java:
##########
@@ -116,42 +116,36 @@ public FieldNestedUpdateAgg(
@Override
public Object agg(Object accumulator, Object inputField) {
- if (accumulator == null || inputField == null) {
- return accumulator == null ? inputField : accumulator;
- }
-
- InternalArray acc = (InternalArray) accumulator;
- InternalArray input = (InternalArray) inputField;
-
- if (acc.size() >= countLimit) {
+ if (inputField == null) {
return accumulator;
}
- int remainCount = countLimit - acc.size();
+ InternalArray input = (InternalArray) inputField;
- List<InternalRow> rows = new ArrayList<>(acc.size() + input.size());
- addNonNullRows(acc, rows);
- addNonNullRows(input, rows, remainCount);
+ if (keyProjection == null) {
+ if (accumulator == null) {
+ return inputField;
Review Comment:
@JingsongLi Good catch, thanks. I agree that the no-key append path should
apply `countLimit` even when `accumulator == null`.
I updated the branch so the initial no-key input now builds a `GenericArray`
from at most `countLimit` non-null input rows instead of returning `inputField`
directly. I also added a regression test for an oversized first input array
with a null element.
--
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]