Skip to content
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

Window interval parser added #1

Merged
merged 2 commits into from
Oct 5, 2022
Merged

Conversation

mustafasrepo
Copy link
Collaborator

@mustafasrepo mustafasrepo commented Sep 30, 2022

Support INTERVAL Inside Window Frames

Which issue does this PR close?

We have added INTERVAL support inside window frames. Now sqlparser can parse queries such as

SELECT 
COUNT(*) OVER (ORDER BY ts RANGE BETWEEN  INTERVAL '1 DAY' PRECEDING AND INTERVAL '1 DAY' FOLLOWING) 
FROM t;

This PR closes the following issue.

The Rationale for this change

Datafusion now supports window frame queries with this merge. However, since window frame bound only accepts u64 values we cannot run queries like the above on Datafusion. If this PR merges, after some minor changes we would be able to run RANGE queries involving INTERVALs using Datafusion. In the roadmap of Datafusion there is a plan to support different types for WindowFrameBound.

@mustafasrepo mustafasrepo force-pushed the window_interval_parser branch 5 times, most recently from eb284be to bcc8754 Compare October 3, 2022 13:37
@mustafasrepo mustafasrepo force-pushed the window_interval_parser branch from bcc8754 to cd7a552 Compare October 3, 2022 13:50
@ozankabak ozankabak force-pushed the window_interval_parser branch from 69aac6f to 10dcfb0 Compare October 5, 2022 10:10
@ozankabak ozankabak self-requested a review October 5, 2022 10:14
Copy link

@ozankabak ozankabak left a comment

Choose a reason for hiding this comment

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

LGTM!

@mustafasrepo mustafasrepo merged commit be9d639 into main Oct 5, 2022
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.

2 participants