Repository navigation
Conversation
|
@andygrove please check this PR |
| "| false |", | ||
| "| false |", | ||
| "+-------------------------------------------------------------+", | ||
| "+------------------------------+", |
There was a problem hiding this comment.
The plan changes sure look nicer 😍
|
Not sure I'm a fan. What happens with the alias if you use a function on more than one column? |
Dandandan
left a comment
There was a problem hiding this comment.
What happens when using the same function more than once?
|
Here is what postgres does: Here is what datafusion-cli does from master: |
@Dandandan thanks for you comment, the engine historically fails if the alias are the same, like if you run supposingly we need a separate ticket to try to do postgres behaviuor, or add some unique postfix like |
|
Ok, but the current branch now also fails with |
This is correct, as we shortened the column name the collision will happen more often. But this gives us more motivation to make unique readable aliases. Moreover user should use custom aliases, not sure its super comfy to refer the column from outer sql to nested subquery which contains not friendly alias like |
Regression now that we can not do trim(a) and trim(b) from table
|
BTW the way postgres handles this, as I recall, is to refer to each output created by a node using its index the output schema rather than a string I don't recommend going this way as debugging errors with mixed up output indexes was both painful and common |
|
@alamb @Dandandan should I put unique col aliasing like |
I am not sure -- perhaps @andygrove can weigh in here as he filed #3722 |
@andygrove please help here until the code rots |
|
I will catch up on this and other pending PRs tomorrow. |
# Conflicts: # datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs
|
Marking this as a draft as it is waiting on feedback and not ready for review or merge |
|
Postgres allows duplicate column names in a schema but then throws an error if you try and select one of those columns. We currently fail on creating a schema with duplicate columns. I guess the first question is, do we want to be more like Postgres here? |
Thanks @andygrove for the feedback. Most likely we should avoid current naming for not qualified columns as its not user friendly and hard to use in outer subqueries. And perhaps its a bigger topic to discuss naming standard, to be like a Postgres or something else, but we can create a discussion ticket on this first, to get all options from contributors. If you ask me, I like how its done in Trino
|
|
Closing as this PR is over a year old. Please feel free to reopen it / rebase it if you plan to keep working on it |
Which issue does this PR close?
Closes #3722 .
Rationale for this change
Use simple names in schema - use the function name in this example and do not add the parameters.
What changes are included in this PR?
Use simple names in schema - use the function name in this example and do not add the parameters.
Are there any user-facing changes?
The unqualified column name will be changed