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
[FriendlySQL] Unpacked COLUMNS() Expression #11872
base: feature
Are you sure you want to change the base?
Conversation
… with unpacked columns
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 for the PR! Looks good - some comments:
|
||
# IN (...) | ||
query I | ||
select 2 in (*COLUMNS(*)) from (select 1, 2, 3) t(a, b, c); |
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.
Could we add some more tests?
- Combining
COLUMNS(*)
with*COLUMNS(*)
- Multiple
*COLUMNS(*)
in the same statement? *COLUMNS(*)
inside the lambda of a*COLUMNS(*)
statement?- Can we test this with a varargs function, e.g.
CONCAT
? - Can we try
*COLUMNS(*) + 42
?
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 noticed that COLUMNS(COLUMNS(COLUMNS(*)))
was allowed, because it wasn't checking for "columns" in the transformer, that now properly errors
This was caused by the check that enables COLUMNS(*)
, COLUMNS
is a StarExpression and *
is a StarExpression
When a StarExpression (*) appears in COLUMNS we just merge them.
But that also allowed COLUMNS(COLUMNS(COLUMNS(*)))
This PR adds the
*COLUMNS(...)
expression that changes the behavior of the existingCOLUMNS(...)
expression.Instead of expanding vertically, instead the list expands horizontally.
To explain this in more detail, here's some SQL:
COLUMNS behavior
When the
COLUMNS
expression is expanded, the resulting query becomes:The result of this query is:
*COLUMNS behavior
When the
*COLUMNS
expression is expanded, the resulting query becomes:The result of this query is: