-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Allow field name declaration in ROW literal #25261
base: master
Are you sure you want to change the base?
Conversation
95e89ed
to
6cbfff3
Compare
I like this, but I would use the following syntax to make it similar to how the implicit row in the SELECT clause is constructed:
That way, the only syntactic difference with the SELECT clause, is that the fields are wrapped in |
As another example, the syntax I suggested above makes these two equivalent:
|
I'm working on the syntax change, but for VALUES the names of the relation aren't sourced from the rows. Today you can name row fields with a cast in values, but they don't effect the values column aliases:
I'm guessing that can be improved, but I have no idea how... work for follow up |
6cbfff3
to
129dee6
Compare
Add support for `row(a 1, b 2)` instead of the much more complex `cast(row(1, 2) as row(a integer, b integer))`.
129dee6
to
85c7a67
Compare
import java.util.stream.Collectors; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
@JsonSerialize | ||
public record Row(List<Expression> items) | ||
public record Row(List<Field> fields) |
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.
It shouldn't be necessary to add the field names in the IR. As far as I recall, there's nothing in the planner/optimizer that can or needs to use them.
Description
Add support for
row(a 1, b 2)
instead of the much more complexcast(row(1, 2) as row(a integer, b integer))
. The old syntax is particularly annoying because you have to repeat the types for the fields.Release notes
(X) Release notes are required, with the following suggested text: