Skip to content

Convert listagg to normal annotated aggregation#12398

Closed
dain wants to merge 3 commits intotrinodb:masterfrom
dain:fix-single-distinct-to-group-byoptimizer
Closed

Convert listagg to normal annotated aggregation#12398
dain wants to merge 3 commits intotrinodb:masterfrom
dain:fix-single-distinct-to-group-byoptimizer

Conversation

@dain
Copy link
Copy Markdown
Member

@dain dain commented May 15, 2022

Description

listagg is currently implemented as a custom/maual aggregation function, but does not need any features unavailable to annotated aggregations.

These changes are extracted from larger PR to rewrite most aggregates as annotated functions . While testing this I found that the SingleDistinctAggregationToGroupBy was causing failures in io.trino.sql.query.TestListagg.testListaggQueryWithDistinct. I believe this is because the optimizer does not handle aggergates with order sensitive aggregates correctly. I have modified the optimizer to skip ordered aggregates, but I am not sure this is the proper fix.

Documentation

(X) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

(X) No release notes entries required.
( ) Release notes entries required with the following suggested text:

dain added 3 commits May 14, 2022 21:36
Similar to filtered aggregates, ordered aggregates  can involved new
symbols not in the original function call, and this optimizer does not
support that model.
@dain dain requested a review from martint May 15, 2022 05:01
@cla-bot cla-bot bot added the cla-signed label May 15, 2022
@hashhar hashhar requested a review from findinpath May 16, 2022 05:27
.argumentType(BOOLEAN)
.build())
.nullable()
.argumentNullability(true, false, false, false, false)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"Fix null parameter declaration in listagg"

Add an explanation to the commit message. What's the issue? It's not obvious from this change

@dain
Copy link
Copy Markdown
Member Author

dain commented May 27, 2022

Merged as part of #11477

@dain dain closed this May 27, 2022
@dain dain deleted the fix-single-distinct-to-group-byoptimizer branch May 27, 2022 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants