-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Throw exceptions in SqlValidator when DISTINCT used over WINDOW #16738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8153a08
better exceptions
sreemanamala b573be5
refactor
sreemanamala 708db8c
post agg with over
sreemanamala d35247a
refactor
sreemanamala 98c5c90
fix conflicts
sreemanamala a38b782
remove test
sreemanamala c2caecf
fix extra columns for empty window
sreemanamala 447f5d9
optimise only when ObjectArrayColumn
sreemanamala c4e22c8
comments
sreemanamala File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
38 changes: 38 additions & 0 deletions
38
sql/src/test/resources/calcite/tests/window/allBoundsCombination.sqlTest
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| type: "operatorValidation" | ||
|
|
||
| sql: | | ||
| select | ||
| cityName, | ||
| count(*) over (partition by cityName order by countryName rows between unbounded preceding and 1 preceding) c1, | ||
| count(*) over (partition by cityName order by countryName rows between unbounded preceding and current row) c2, | ||
| count(*) over (partition by cityName order by countryName rows between unbounded preceding and 1 following) c3, | ||
| count(*) over (partition by cityName order by countryName rows between unbounded preceding and unbounded following) c4, | ||
| count(*) over (partition by cityName order by countryName rows between 3 preceding and 1 preceding) c5, | ||
| count(*) over (partition by cityName order by countryName rows between 1 preceding and current row) c6, | ||
| count(*) over (partition by cityName order by countryName rows between 1 preceding and 1 FOLLOWING) c7, | ||
| count(*) over (partition by cityName order by countryName rows between 1 preceding and unbounded FOLLOWING) c8, | ||
| count(*) over (partition by cityName order by countryName rows between 1 FOLLOWING and unbounded FOLLOWING) c9, | ||
| count(*) over (partition by cityName order by countryName rows between 1 FOLLOWING and 3 FOLLOWING) c10, | ||
| count(*) over (partition by cityName order by countryName rows between current row and 1 following) c11, | ||
| count(*) over (partition by cityName order by countryName rows between current row and unbounded following) c12 | ||
| from wikipedia | ||
| where cityName in ('Vienna', 'Seoul') | ||
| group by countryName, cityName, added | ||
|
|
||
| expectedResults: | ||
| - ["Seoul",0,1,2,13,0,1,2,13,12,3,2,13] | ||
| - ["Seoul",1,2,3,13,1,2,3,13,11,3,2,12] | ||
| - ["Seoul",2,3,4,13,2,2,3,12,10,3,2,11] | ||
| - ["Seoul",3,4,5,13,3,2,3,11,9,3,2,10] | ||
| - ["Seoul",4,5,6,13,3,2,3,10,8,3,2,9] | ||
| - ["Seoul",5,6,7,13,3,2,3,9,7,3,2,8] | ||
| - ["Seoul",6,7,8,13,3,2,3,8,6,3,2,7] | ||
| - ["Seoul",7,8,9,13,3,2,3,7,5,3,2,6] | ||
| - ["Seoul",8,9,10,13,3,2,3,6,4,3,2,5] | ||
| - ["Seoul",9,10,11,13,3,2,3,5,3,3,2,4] | ||
| - ["Seoul",10,11,12,13,3,2,3,4,2,2,2,3] | ||
| - ["Seoul",11,12,13,13,3,2,3,3,1,1,2,2] | ||
| - ["Seoul",12,13,13,13,3,2,2,2,0,0,1,1] | ||
| - ["Vienna",0,1,2,3,0,1,2,3,2,2,2,3] | ||
| - ["Vienna",1,2,3,3,1,2,3,3,1,1,2,2] | ||
| - ["Vienna",2,3,3,3,2,2,2,2,0,0,1,1] |
10 changes: 10 additions & 0 deletions
10
sql/src/test/resources/calcite/tests/window/duplicateAggregation.sqlTest
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| type: "operatorValidation" | ||
|
|
||
| sql: | | ||
| select | ||
| rank() over (order by count(*) desc), | ||
| rank() over (order by count(*) desc) | ||
| from wikipedia | ||
|
|
||
| expectedResults: | ||
| - [1,1] |
19 changes: 19 additions & 0 deletions
19
sql/src/test/resources/calcite/tests/window/windowInsideSubquery.sqlTest
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| type: "operatorValidation" | ||
|
|
||
| sql: | | ||
| select | ||
| c | ||
| from | ||
| ( | ||
| select channel, row_number() over () as c | ||
| from wikipedia | ||
| group by channel | ||
| ) | ||
| LIMIT 5 | ||
|
|
||
| expectedResults: | ||
| - [1] | ||
| - [2] | ||
| - [3] | ||
| - [4] | ||
| - [5] |
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.
Uh oh!
There was an error while loading. Please reload this page.