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.
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
Support
IGNORE|RESPECT
NULLs clause in window functions #998Support
IGNORE|RESPECT
NULLs clause in window functions #998Changes from 9 commits
0a7123b
78cad93
c8ac7fd
3035a79
fa507d8
c8cb2c4
5e5a047
25da82a
9819639
e5b30e5
504a215
b7b9b30
a914309
6432c94
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why were these tests changed?
This PR adds support for window functions (aka those that have an
OVER
clause) which is different than theORDER BY
clause in the aggregate function argument.I think you should keep the existing tests and add a new one for the IGNORE NULLS / RESPECT NULLs syntax
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback @alamb .
Please look at the syntax of
FIRST_VALUE
(for example) in some of the dialects:https://docs.snowflake.com/en/sql-reference/functions/first_value
https://learn.microsoft.com/en-us/sql/t-sql/functions/first-value-transact-sql?view=sql-server-ver16
https://www.postgresqltutorial.com/postgresql-window-function/postgresql-first_value-function/
The
Over
Keyword is a must. so the syntaxFIRST_VALUE(x ORDER BY x)
is not valid.Even if the tests pass, those tests are not aligned with the syntax.
That's why I added two arrays of dialects - for each dialect his supported syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that is true when the FIRST_VALUE function is being used as a window function
Some systems allow
FIRST_VALUE
to be used as normal aggregate functions -- so likePerhaps @mustafasrepo can offer some perspective as the author of #882
But basically I think we should retain these tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually
FIRST_VALUE
andLAST_VALUE
can be used as window or aggregate function (similar toSUM
,MIN
, etc.). In these tests, they are used as aggregate function. Hence these tests should remain as is.But having the window tests
FIRST_VALUE
andLAST_VALUE
is also helpful. I think you shouldn't modify existing test, and add your test a a new test.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @alamb and @mustafasrepo :) Learned something about these functions :)
I maintained the old tests