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

Support window functions like row_number() #135

Open
jrmuizel opened this issue Jul 4, 2020 · 4 comments
Open

Support window functions like row_number() #135

jrmuizel opened this issue Jul 4, 2020 · 4 comments

Comments

@jrmuizel
Copy link

jrmuizel commented Jul 4, 2020

This would be nice to have.

@cswinter
Copy link
Owner

cswinter commented Jul 4, 2020

There actually used to be support for an OFFSET clause and it looks like the query engine still supports that functionality, it was only unsupported by the new parser but looks like making this work again it fairly easy: #136
Once that has landed, queries with an OFFSET <rows> ROWS clause should work.

@cswinter
Copy link
Owner

cswinter commented Jul 4, 2020

Fixed in v0.3.4

@cswinter cswinter closed this as completed Jul 4, 2020
@jrmuizel
Copy link
Author

jrmuizel commented Jul 4, 2020

I was looking to number the rows with a query like

SELECT x, y, row_number() OVER (ORDER BY y) AS row_number FROM t0 ORDER BY x;

@cswinter
Copy link
Owner

cswinter commented Jul 4, 2020

I see. Adding just the row_number() should be relatively straightforward, but the OVER (ORDER BY y) clause is more involved since it requires two separate sort/query passes which the query engine does not currently support. If there was support for arbitrary subqueries it might be possible to implement this as a desugaring compiler pass, though that's an even larger undertaking. I don't expect I will work on this in the foreseeable future.

@cswinter cswinter reopened this Jul 4, 2020
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

No branches or pull requests

2 participants