paimon icon indicating copy to clipboard operation
paimon copied to clipboard

[Bug] Paimon ROW Type Internal Field Sum Aggregation Not Working

Open qihongze opened this issue 2 months ago • 1 comments

Search before asking

  • [x] I searched in the issues and found nothing similar.

Paimon version

1.2

Compute Engine

Flink 1.20

Minimal reproduce step

Hi, I'm encountering an issue where the sum aggregation on internal fields of a ROW type in Paimon doesn't work as expected. Instead of aggregating values, the data is overwritten (only the last value is retained). Here's a reproducible test case:

  1. my DDL CREATE TABLE "test_row_agg" ( "id" INT, "data" ROW("num" INT, "info" VARCHAR) ) WITH ( options='{ "merge-engine":"aggregation", "fields.data.num.aggregate-function":"sum", "fields.data.sequence-group":"data" }', primary_key=ARRAY['id'], bucket=4, bucket_key=ARRAY['id'] );
  2. Insert Test Data (Two Writes with the Same Primary Key) INSERT INTO "test_row_agg" ("id", "data") VALUES (1, ROW(10, 'info1'));

INSERT INTO "test_row_agg" ("id", "data") VALUES (1, ROW(20, 'info2')); 3. Query Result SELECT "id", "data"."num" FROM "test_row_agg" WHERE "id" = 1;

I expected data.num = 30 ,But,Actual Result is 20 why? I create table and config "fields.data.num.aggregate-function":"sum", But not sum

What doesn't meet your expectations?

Expected: (1, 30, 'info2') Actual: (1, 20, 'info2')

Anything else?

No response

Are you willing to submit a PR?

  • [ ] I'm willing to submit a PR!

qihongze avatar Oct 26 '25 04:10 qihongze

Currently agg func only works for the top level field, but cannot work for nested fields.

qihongze avatar Oct 27 '25 09:10 qihongze