You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fluss.apache.org by "fresh-borzoni (via GitHub)" <gi...@apache.org> on 2026/10/08 23:23:44 UTC
[I] [server] Aggregation merge engine for the last N elements of an array [fluss]
fresh-borzoni opened a new issue, #4569:
URL: https://github.com/apache/fluss/issues/4569
### Search before asking
- [x] I searched in the [issues](https://github.com/apache/fluss/issues) and found nothing similar.
### Description
A common use of a primary key table is serving the recent history of an entity with one lookup: the last 50 events of a user, the last 20 transactions of a card. The aggregation merge engine has no function for arrays, so today this needs a Flink job that keeps the same N events per key in its own state and writes the whole array to Fluss, or a row per event and a prefix lookup, which returns every row of the key in byte order with no limit.
Paimon doesn't cover this either. `collect` grows without a bound, and `nested_update` with `count-limit` stops adding rows once it is full, so it keeps the first N, not the last.
Add a `last_n` aggregate function for ARRAY columns with a required `size` parameter. Each input array is appended to the stored array, and only the last `size` elements are kept. A null input leaves the column unchanged.
```
'fields.events.agg' = 'last_n',
'fields.events.last_n.size' = '50'
```
Every update rewrites the stored array, and with `table.changelog.image` = FULL both the old and the new array go to the changelog, so this is meant for small `size` values.
### Willingness to contribute
- [x] I'm willing to submit a 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: issues-unsubscribe@fluss.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [server] Aggregation merge engine for the last N elements of an array [fluss]
Posted by "platinumhamburg (via GitHub)" <gi...@apache.org>.
platinumhamburg closed issue #4569: [server] Aggregation merge engine for the last N elements of an array
URL: https://github.com/apache/fluss/issues/4569
--
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: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org