-
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
Improve column naming by aliasing with expression name #280
Conversation
Codecov Report
@@ Coverage Diff @@
## master #280 +/- ##
==========================================
- Coverage 76.19% 76.13% -0.06%
==========================================
Files 140 140
Lines 23595 23607 +12
==========================================
- Hits 17978 17974 -4
- Misses 5617 5633 +16
Continue to review full report at Codecov.
|
I will do some more research into what's needed for column names, I think we have to avoid reusing alias for this and see if we should support unnamed columns better. |
This is an interesting idea -- and seems similar to what @wqc200 was working on in apache/arrow#9600 |
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.
I don't really understand the concerns about column expressions and what might be bad here. The alternate is probably to keep a "name" field on all Exprs
which was the approach in apache/arrow#9600
@@ -1517,7 +1520,7 @@ mod tests { | |||
fn select_no_relation() { | |||
quick_test( | |||
"SELECT 1", | |||
"Projection: Int64(1)\ | |||
"Projection: Int64(1) AS 1\ |
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.
This seems like an improvement to me.
Happy to reconsider! My main concern is that introducing aliases for unnamed expressions will cause other "strange" issues like using the name of the expression, like: Which should fail but would return 2? I think we should make sure unnamed expressions can only be referenced by index, or with |
That makes sense, thank you for the clarification
…On Fri, May 7, 2021 at 5:53 PM Daniël Heres ***@***.***> wrote:
I don't really understand the concerns about column expressions and what
might be bad here. The alternate is probably to keep a "name" field on all
Exprs which was the approach in apache/arrow#9600
<apache/arrow#9600>
Happy to reconsider! My main concern is that introducing aliases for
unnamed expressions will cause other "strange" issues like using the name
of the expression, like:
select "1+1" from (select 1+1) t
Which should fail but would return 2?
I think we should make sure unnamed expressions can only be referenced by
index, or with * and not by a generated name.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#280 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADXZMJ5SN5I2FDE3TBHR2TTMRON7ANCNFSM44H4TNUA>
.
|
+1, I did some research on this as well, postgresql even name most of the unnamed expression |
Which issue does this PR close?
Closes #279
Rationale for this change
To support optimizations like constant folding the column names need to keep consistent.
This PR also improves the display of column names.
What changes are included in this PR?
alias
using the formatted sql expression. This keeps us much closer to the original expression (which you can see in the tests).#col AS col
Are there any user-facing changes?
Yes, column names will be different.