Check consistency of param N for min_byN/max_byN#21306
Merged
Conversation
|
|
Contributor
Author
|
Signed CLA |
tdcmeehan
requested changes
Nov 3, 2023
Contributor
tdcmeehan
left a comment
There was a problem hiding this comment.
LGTM % nit on the test
Comment on lines
296
to
301
Contributor
There was a problem hiding this comment.
Suggested change
| @Test | |
| public void testInconsistentN() | |
| { | |
| JavaAggregationFunctionImplementation function = getMaxByAggregation(BIGINT, BIGINT, BIGINT); | |
| try { | |
| groupedAggregation(function, new Page(createDoublesBlock(new Double[] {3.0, 2.0, 1.0}), createDoublesBlock(new Double[] {1.0, 2.0, 3.0}), createLongsBlock(new Long[] {2L, 2L, 3L}))); | |
| } | |
| catch (PrestoException e) { | |
| assertEquals(e.getMessage(), "Count argument is not constant: found multiple values [3, 2]"); | |
| } | |
| } | |
| @Test(expectedExceptions = PrestoException.class, expectedExceptionsMessageRegExp = "Count argument is not constant: found multiple values [3, 2") | |
| public void testInconsistentN() | |
| { | |
| JavaAggregationFunctionImplementation function = getMaxByAggregation(BIGINT, BIGINT, BIGINT); | |
| groupedAggregation(function, new Page(createDoublesBlock(new Double[] {3.0, 2.0, 1.0}), createDoublesBlock(new Double[] {1.0, 2.0, 3.0}), createLongsBlock(new Long[] {2L, 2L, 3L}))); | |
| } |
Contributor
|
CC: @xumingming |
Contributor
|
Thanks @mmorgan1230 @tdcmeehan |
d1a73bd to
29d1ff8
Compare
Contributor
Author
|
FYI - had to reset back 1 commit as I had the incorrect local git config setup. I recommitted the same content as the initial commit that was reviewed and will update the test with a follow up commit. |
Contributor
|
LGTM! Please squash commits and I can approve. |
PR item update testInconsistentN for maxbyN/minbyN
40814f0 to
e304fa9
Compare
tdcmeehan
approved these changes
Nov 6, 2023
26 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.
Description
Fixes issue #20920 to check for uniqueness/consistency of N for maxbyN/minbyN aggregate functions.
Motivation and Context
Currently the uniqueness/consistency of param N of minbyN/maxbyN is not checked.
Impact
The test case in issue #20920 now fails as expected:
Test Plan
Added UT
testInconsistentN()inside/presto-main/src/test/java/com/facebook/presto/operator/aggregation/minmaxby/TestMinMaxByNAggregation.javaContributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.