fix: do not rewrite single columns in derived tables#11419
Merged
systay merged 1 commit intovitessio:mainfrom Oct 3, 2022
Merged
fix: do not rewrite single columns in derived tables#11419systay merged 1 commit intovitessio:mainfrom
systay merged 1 commit intovitessio:mainfrom
Conversation
Signed-off-by: Andres Taylor <andres@planetscale.com>
Contributor
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
If a new flag is being introduced:
If a workflow is added or modified:
Bug fixes
Non-trivial changes
New/Existing features
Backward compatibility
|
frouioui
reviewed
Oct 3, 2022
Comment on lines
+546
to
+549
| // If we find a single col-name in a `dual` subquery, we can be pretty sure the user is returning a column | ||
| // already projected. | ||
| // `select 1 as x, (select x)` | ||
| // is perfectly valid - any aliased columns to the left are available inside subquery scopes |
Member
There was a problem hiding this comment.
TIL:
mysql> select 1 as x, (select x);
+---+------------+
| x | (select x) |
+---+------------+
| 1 | 1 |
+---+------------+
1 row in set (0.00 sec)
frouioui
reviewed
Oct 3, 2022
Comment on lines
-40
to
-42
| // PushPredicate implements the PhysicalOperator interface | ||
| func (f *Filter) PushPredicate(expr sqlparser.Expr, semTable *semantics.SemTable) error { | ||
| panic("unimplemented") |
Member
There was a problem hiding this comment.
While we are at it, we could also remove Table.PushPredicate
frouioui
approved these changes
Oct 3, 2022
harshit-gangal
approved these changes
Oct 3, 2022
Contributor
|
I was unable to backport this Pull Request to the following branches: |
systay
added a commit
to planetscale/vitess
that referenced
this pull request
Oct 10, 2022
Signed-off-by: Andres Taylor <andres@planetscale.com> Signed-off-by: Andres Taylor <andres@planetscale.com>
3 tasks
systay
added a commit
that referenced
this pull request
Oct 10, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The Vitess vtgate planner was doing an bad query rewrite. A query such as this:
would get rewritten to:
This PR stops these rewrites from being performed.
Related Issue(s)
Fixes #11246
Checklist