Skip to content

Fix handing of grouped ordered aggregations with filtering#13627

Merged
dain merged 1 commit intotrinodb:masterfrom
dain:ordered-aggregation-filtered-out
Aug 13, 2022
Merged

Fix handing of grouped ordered aggregations with filtering#13627
dain merged 1 commit intotrinodb:masterfrom
dain:ordered-aggregation-filtered-out

Conversation

@dain
Copy link
Member

@dain dain commented Aug 12, 2022

When a grouped ordered aggregation input is completely filtered, the underlying aggregation must still be informed of the empty groups.

Related issues, pull requests, and links

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

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

# General
* Fix some failure of queries with grouped aggregations that are ordered and filtered. ({issue}`issuenumber`)

@dain dain requested a review from sopel39 August 12, 2022 00:52
@cla-bot cla-bot bot added the cla-signed label Aug 12, 2022
@dain dain force-pushed the ordered-aggregation-filtered-out branch from cc73d94 to b9760cb Compare August 12, 2022 01:47
Copy link
Member

Choose a reason for hiding this comment

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

the same seems to be required for DistinctAccumulator

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. I looked at DistinctAccumulator also, and missed the place where it skips input

Copy link
Member Author

Choose a reason for hiding this comment

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

The existing distinct code is correct, but I added a test to verify that we don't introduce this bug in that code (also, I verified the test catches the bug if we change the code). I also added a comment to the distinct code to remind people about the issue

When a grouped ordered aggregation input is completely filtered, the
underlying aggregation must still be informed of the empty groups.
@dain dain force-pushed the ordered-aggregation-filtered-out branch from b9760cb to 363ae5c Compare August 12, 2022 20:25
@dain dain merged commit 24f6f89 into trinodb:master Aug 13, 2022
@dain dain deleted the ordered-aggregation-filtered-out branch August 13, 2022 00:52
@github-actions github-actions bot added this to the 393 milestone Aug 13, 2022
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.

Get Null Pointer Exception in some queries doing array_agg

3 participants