-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Suport unparsing LogicalPlan::Window
to SQL
#10664
Comments
I'd like to take it if no one picks it today. :) |
I tried to implement for a while and I have a question,
However, for an aggregate, there's not.
In my understanding, window function is a special case of aggregate function, why would these two have different plan struct? |
I think window funtions and aggregate functions are different. Somewhat confusingly is that you can use aggregate functions as window functions Window functions always have an So for example, this is a normal aggregate select count(x) from foo; However, this is count being used as a window aggregate: select count(x) OVER (PARTITION BY y) from foo; |
I took a stab at this in #10767. It can be handled similarly to how we currently handle LogicalPlan::Aggregate. |
Is your feature request related to a problem or challenge?
Part of #9726 to complete the LogialPlan --> SQL conversion
Converting
LogicalPlan
back toSQL
is valuable for several usecases such as using DataFusion to programatically create SQL -- see theplan_to_sql.rs
exampleDescribe the solution you'd like
Support converting SQL with window functions like this:
Describe alternatives you've considered
The basic pattern is this (see #10371 for an example):
Unparser::plan_to_sql
(source link)roundtrip_statement
insql_integration.rs
source linkNote you can run the tests like
cargo test -p datafusion-sql -- roundtrip_statement
Additional context
I think this is a good first issue as the pattern is well established and there are explicit instructions
The text was updated successfully, but these errors were encountered: