Skip to content

[Enhancement] add trino function map_agg#66673

Merged
stdpain merged 1 commit intoStarRocks:mainfrom
guoxiaolongzte:add-trinoFunction-map_agg
Dec 31, 2025
Merged

[Enhancement] add trino function map_agg#66673
stdpain merged 1 commit intoStarRocks:mainfrom
guoxiaolongzte:add-trinoFunction-map_agg

Conversation

@guoxiaolongzte
Copy link
Contributor

@guoxiaolongzte guoxiaolongzte commented Dec 12, 2025

Why I'm doing:

When using the Trino dialect, the map_agg function is not supported.

https://trino.io/docs/385/functions/aggregate.html?highlight=map_agg#map_agg

What I'm doing:

map_agg(key, value) -> map_from_arrays(array_agg(key), array_agg(value))

support the map_agg function.

Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • [x ] I have checked the version labels which the pr will be auto-backported to the target branch
    • 4.0
    • 3.5
    • 3.4
    • 3.3

Note

Adds Trino map_agg(key, value) support by rewriting to map_from_arrays(array_agg(key), array_agg(value)) and includes a unit test.

  • Trino function transformation:
    • In fe/fe-core/src/main/java/com/starrocks/connector/parser/trino/ComplexFunctionCallTransformer.java:
      • Add support for map_agg(key, value) -> map_from_arrays(array_agg(key), array_agg(value)) with arg count validation.
  • Tests:
    • In fe/fe-core/src/test/java/com/starrocks/connector/parser/trino/TrinoFunctionTransformTest.java:
      • Add testMapFunction asserting transformation to array_agg('key'), array_agg('value') and map_from_arrays(...).

Written by Cursor Bugbot for commit db8dedd. This will update automatically on new commits. Configure here.

@mergify
Copy link
Contributor

mergify bot commented Dec 12, 2025

🧪 CI Insights

Here's what we observed from your CI run for db8dedd.

🟢 All jobs passed!

But CI Insights is watching 👀

@alvin-celerdata
Copy link
Contributor

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no bugs!


@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@github-actions
Copy link
Contributor

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions
Copy link
Contributor

[FE Incremental Coverage Report]

pass : 5 / 6 (83.33%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/connector/parser/trino/ComplexFunctionCallTransformer.java 5 6 83.33% [129]

@github-actions
Copy link
Contributor

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@stdpain stdpain merged commit 5bb8ab7 into StarRocks:main Dec 31, 2025
103 of 110 checks passed
@github-actions
Copy link
Contributor

@Mergifyio backport branch-4.0

@github-actions
Copy link
Contributor

@Mergifyio backport branch-3.3

@github-actions
Copy link
Contributor

@Mergifyio backport branch-3.4

@github-actions
Copy link
Contributor

@Mergifyio backport branch-3.5

@mergify
Copy link
Contributor

mergify bot commented Dec 31, 2025

backport branch-4.0

✅ Backports have been created

Details

@mergify
Copy link
Contributor

mergify bot commented Dec 31, 2025

backport branch-3.3

✅ Backports have been created

Details

@mergify
Copy link
Contributor

mergify bot commented Dec 31, 2025

backport branch-3.4

✅ Backports have been created

Details

@mergify
Copy link
Contributor

mergify bot commented Dec 31, 2025

backport branch-3.5

✅ Backports have been created

Details

mergify bot pushed a commit that referenced this pull request Dec 31, 2025
mergify bot pushed a commit that referenced this pull request Dec 31, 2025
mergify bot pushed a commit that referenced this pull request Dec 31, 2025
mergify bot pushed a commit that referenced this pull request Dec 31, 2025
@github-actions github-actions bot added the 4.0 label Jan 2, 2026
wanpengfei-git pushed a commit that referenced this pull request Jan 2, 2026
Co-authored-by: guoxiaolong <xiaolong.guo@vivo.com>
farhad-celo pushed a commit to farhad-celo/starrocks that referenced this pull request Jan 20, 2026
Signed-off-by: Farhad Shahmohammadi <f.shahmohammadi@celonis.com>
farhad-celo pushed a commit to farhad-celo/starrocks that referenced this pull request Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants