-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Handle alias when parsing sql(parse_sql_expr) #12939
Conversation
This PR duplicates some of the function that return Expr(sqlparser) and add _with_alias to their name(change return type to However, I thinks the duplication is unneeded for function that return Expr(datafusion), because datafusion already have Alias entry in Expr enum. |
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 @Eason0729 !
I looked at #12518
Could you possible add a test showing the usecase from that issue working?
For example a test that does something like:
df.parse_sql_expr("SUM(int_col) as sum_int_col")
FYI @milenkovicm |
Sure, I will work on that next week. |
Marking as draft as I think this PR is no longer waiting on feedback. Please mark it as ready for review when it is ready for another look |
…alias for function
@Eason0729 should you fix
|
Sorry, I didn't notice the fact that the example(test) should fail. Let's mark this PR as draft again, because I am not going to fix that until next weekend(I have some exam recently). Also, I just found how to mark PR as draft! 🍪 |
Good luck on the exam! |
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.
Thank you @Eason0729 -- this looks great to me
cc @milenkovicm
Thanks again @Eason0729 for sticking with this |
* fix: Fix parse_sql_expr not handling alias * cargo fmt * fix parse_sql_expr example(remove alias) * add testing * add SUM udaf to TestContextProvider and modify test_sql_to_expr_with_alias for function * revert change on example `parse_sql_expr`
* fix: Fix parse_sql_expr not handling alias * cargo fmt * fix parse_sql_expr example(remove alias) * add testing * add SUM udaf to TestContextProvider and modify test_sql_to_expr_with_alias for function * revert change on example `parse_sql_expr`
Which issue does this PR close?
Close #12518
Also, we need to wait for next
sqlparser
release, so this PR is expected to be draft for a while.Rationale for this change
What changes are included in this PR?
add
sql_expr_to_logical_expr_with_alias
andparse_sql_into_dialect_with_alias
function, whose returns contain alias if there is alias.Are these changes tested?
Are there any user-facing changes?