Skip to content

Conversation

@759434091
Copy link
Contributor

[core] Adjust distinct option in FieldListaggAgg operator

Purpose

  1. [Fix] Fix field.{fieldName}.aggregate-function=listagg behavior when handling empty strings
  2. [Feature] Adjust field.{fieldName}.distict behavior when aggregating strings

Expected behavior:

case Input A Input B Current Output Expected Output
listagg 'user1,user2,user3' '' (empty string) 'user1,user2,user3,' 'user1,user2,user3'
listagg & distinct #6566 'user1,user2,user3' 'user1,user4' 'user1,user2,user3,user1,user4' 'user1,user2,user3,user4'
listagg '' (empty string) 'user1,user2,user3' ',user1,user2,user3' 'user1,user2,user3'

Tests

  • org.apache.paimon.mergetree.compact.aggregate.FieldAggregatorTest#testFieldListAggWithDefaultDelimiterAndDistinct
  • org.apache.paimon.mergetree.compact.aggregate.FieldAggregatorTest#testFieldListAggWithDefaultDelimiterAndDistinctWithMultiUser
  • org.apache.paimon.mergetree.compact.aggregate.FieldAggregatorTest#testFieldListAggWithDefaultDelimiterAndDistinctWithEmptyLeftUser
  • org.apache.paimon.mergetree.compact.aggregate.FieldAggregatorTest#testFieldListAggWithDefaultDelimiterAndDistinctWithMultiKvString
  • org.apache.paimon.mergetree.compact.aggregate.FieldAggregatorTest#testFieldListAggWithDefaultDelimiterAndDistinctWithMultiDuplicatedKvString

API and Format

No Changes.

Documentation

docs/content/primary-key-table/merge-engine/aggregation.md

@759434091 759434091 changed the title [core] Adjust distinct option in FieldListaggAgg operator [core] Adjust distinct option behavior in FieldListaggAgg operator Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant