JingsongLi commented on code in PR #8272:
URL: https://github.com/apache/paimon/pull/8272#discussion_r3445539494
##########
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:
Could we also apply the count limit to the no-key initial input case? This
branch returns the whole `inputField` when `accumulator == null`, so a first
write such as `countLimit = 2` with `ARRAY[row1, row2, row3]` keeps all three
rows. The no-key path is append mode, and the existing count-limit test already
expects rows beyond the limit to be dropped, so the null-accumulator case
should probably build a `GenericArray` from at most `countLimit` non-null input
rows instead of returning `inputField` directly.
--
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]