-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
opt: fix hidden column handling for WITH #41187
Conversation
Remove hidden columns from CTE sources. Statements that return hidden columns are rare but they do exist (EXPLAIN, SHOW ZONE CONFIGURATION). When used as a CTE, these hidden columns should be removed. Also making a small fix to `removeHiddenCols`: it's not ok to remove a hidden column if it is referenced by the ordering; now we move the hidden columns to `extraCols` instead. I could not come up with an example where this was a problem with the current uses. Release justification: low-cost fix to new functionality. Release note: None
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @justinj, @RaduBerinde, and @rytaft)
pkg/sql/opt/optbuilder/testdata/with, line 768 at r1 (raw file):
# Check hidden column handling: level, node_type should not be output. build WITH cte AS (EXPLAIN (VERBOSE) SELECT 1) SELECT * FROM cte
this is allowed??
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @justinj and @rytaft)
pkg/sql/opt/optbuilder/testdata/with, line 768 at r1 (raw file):
Previously, justinj (Justin Jaffray) wrote…
this is allowed??
Yeah.. We could trim down the list of supported statements, but I think it's valuable to support at least everything that [ ... ]
supports so there aren't cases where you're forced to use the bracket syntax.
bors r+ |
1 similar comment
bors r+ |
Build failed |
bors r+ |
41187: opt: fix hidden column handling for WITH r=RaduBerinde a=RaduBerinde Remove hidden columns from CTE sources. Statements that return hidden columns are rare but they do exist (EXPLAIN, SHOW ZONE CONFIGURATION). When used as a CTE, these hidden columns should be removed. Also making a small fix to `removeHiddenCols`: it's not ok to remove a hidden column if it is referenced by the ordering; now we move the hidden columns to `extraCols` instead. I could not come up with an example where this was a problem with the current uses. Release justification: low-cost fix to new functionality. Release note: None Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
Build succeeded |
Remove hidden columns from CTE sources. Statements that return hidden
columns are rare but they do exist (EXPLAIN, SHOW ZONE CONFIGURATION).
When used as a CTE, these hidden columns should be removed.
Also making a small fix to
removeHiddenCols
: it's not ok to remove ahidden column if it is referenced by the ordering; now we move the
hidden columns to
extraCols
instead. I could not come up with anexample where this was a problem with the current uses.
Release justification: low-cost fix to new functionality.
Release note: None