Skip to content

Accept WINDOW clause after QUALIFY when parsing #1218

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

Closed
wants to merge 1 commit into from

Conversation

iffyio
Copy link
Contributor

@iffyio iffyio commented Apr 14, 2024

The positioning of QUALIFY and WINDOW clauses differ between dialects.
BigQuery requires that WINDOW clauses come after QUALIFY which fails on the parser as a result.
This updates the parser to accept the clauses in either order.
It's also possible to flag this behavior on the dialect level so that we don't parse one for the other (didn't opt for that in this case because it felt like a minor detail but probably make more sense), let me know if that's preferred! Actually found some dialects like databricks can accept either order so probably makes sense to have the parser accept in any order

BigQuery requires that WINDOW clauses come after QUALIFY which the
parser currently does not support. This updates the parser to
accept the clauses in either order.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 8678974573

Details

  • 26 of 28 (92.86%) changed or added relevant lines in 3 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.007%) to 88.082%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser/mod.rs 12 14 85.71%
Files with Coverage Reduction New Missed Lines %
src/parser/mod.rs 2 82.97%
Totals Coverage Status
Change from base Build 8660968190: -0.007%
Covered Lines: 21299
Relevant Lines: 24181

💛 - Coveralls

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Looks good to me -- thanks @iffyio

@alamb alamb enabled auto-merge (squash) May 3, 2024 17:52
@alamb alamb disabled auto-merge May 3, 2024 17:57
@alamb
Copy link
Contributor

alamb commented May 3, 2024

This branch has conflicts so I couldn't merge it directly. Instead i made #1248 with the same commit

@alamb alamb closed this in #1248 May 3, 2024
@iffyio iffyio deleted the window-qualify-ordering branch July 16, 2024 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants