-
Notifications
You must be signed in to change notification settings - Fork 752
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 parse select expr as alias_name
#4841
support parse select expr as alias_name
#4841
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/databend/databend/DvnZBNNsgP5Q1QhSJTE2VJXqkpAo [Deployment for 92dc8aa canceled] |
Thanks for the contribution! Please review the labels and make any necessary changes. |
Expr::Cast { expr, data_type } => Ok(Expr::Cast { | ||
Expr::Cast { | ||
expr, data_type, .. | ||
} => Ok(Expr::Cast { |
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.
@b41sh Hi the pg_style can be set false at there?
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.
We don't used pg_style
, i think it's OK here.
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.
we can set pg_style
as false, it is used to distinguish the field names of two different casts.
select cast(a as int8) from test;
select a::int8 from test;
I am working on this modification, you can set it as false
first.
This need a stateless test, it is easy to find the bug when the new sqlparser is introduced someday. |
a5968a4
to
92dc8aa
Compare
Yep, you are right. Added. |
Expr::Cast { | ||
expr, | ||
data_type, | ||
pg_style: _pg_style, |
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.
Does the new version of sqlparser introduced pg_style
params?
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.
datafuse-extras/sqlparser-rs@b0571e8
Yes in this commit.
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.
O, @b41sh should know it better :D
/LGTM |
I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/
Summary
After this pr, this SQL will return err.
The err occurs in sqlparser, the err has already been fixed there.
Changelog
Related Issues
Fixes #4840