Fix MIN(x, n) and MAX(x, n) returning NULL on window aggregations#18615
Merged
kaikalur merged 1 commit intoprestodb:masterfrom Nov 5, 2022
Merged
Fix MIN(x, n) and MAX(x, n) returning NULL on window aggregations#18615kaikalur merged 1 commit intoprestodb:masterfrom
kaikalur merged 1 commit intoprestodb:masterfrom
Conversation
69343e2 to
5d8d561
Compare
Contributor
|
Please add a couple of e2e test in abstract test queries that actually tests queries in a distributed environment |
5d8d561 to
1f69cef
Compare
Contributor
Author
Added some e2e tests |
kaikalur
approved these changes
Nov 3, 2022
highker
approved these changes
Nov 4, 2022
presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java
Outdated
Show resolved
Hide resolved
presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java
Outdated
Show resolved
Hide resolved
presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java
Outdated
Show resolved
Hide resolved
presto-main/src/test/java/com/facebook/presto/operator/window/TestMinMaxNFunction.java
Outdated
Show resolved
Hide resolved
presto-main/src/test/java/com/facebook/presto/operator/window/TestMinMaxNFunction.java
Outdated
Show resolved
Hide resolved
1f69cef to
d7fcbd9
Compare
Contributor
Author
|
Addressed the issues, should be good to merge |
30 tasks
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These functions have an odd behaviour when used on window aggregations. They return NULL for all rows except the first one in the window, because the heap is being cleared by popAll here, so calling output() a second time will return NULL. We add a call to recover the state of the heap after building the output array.
Test plan -

Before
After

Unit test:
mvn test -Dtest=TestMinMaxNFunction+ non regressionmvn test -Dtest=TestMinMaxByNAggregation