-
Notifications
You must be signed in to change notification settings - Fork 2k
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
planner fix: scoping rules for JOIN ON expression inside a subquery #12881
Merged
Conversation
This file contains 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
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
harshit-gangal
added
Type: Enhancement
Logical improvement (somewhere between a bug and feature)
Component: Query Serving
labels
Apr 12, 2023
vitess-bot
bot
added
NeedsDescriptionUpdate
The description is not clear or comprehensive enough, and needs work
NeedsWebsiteDocsUpdate
What it says
labels
Apr 12, 2023
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
|
Signed-off-by: harshit-gangal <harshit@planetscale.com>
systay
changed the title
fix: scoping rules for on clause expression inside a subquery
planner fix: scoping rules for JOIN ON expression inside a subquery
Apr 13, 2023
systay
added
Backport to: release-14.0
and removed
NeedsWebsiteDocsUpdate
What it says
labels
Apr 13, 2023
systay
reviewed
Apr 13, 2023
Signed-off-by: harshit-gangal <harshit@planetscale.com>
harshit-gangal
removed
the
NeedsDescriptionUpdate
The description is not clear or comprehensive enough, and needs work
label
Apr 13, 2023
harshit-gangal
requested review from
frouioui,
GuptaManan100 and
arthurschreiber
as code owners
April 13, 2023 12:08
systay
approved these changes
Apr 13, 2023
frouioui
approved these changes
Apr 13, 2023
I was unable to backport this Pull Request to the following branches: |
frouioui
pushed a commit
to planetscale/vitess
that referenced
this pull request
Apr 13, 2023
…itessio#12881) * fix: scoping rules for on clause expression inside a subquery Signed-off-by: Harshit Gangal <harshit@planetscale.com> * find the parent scope of the statement in on clause Signed-off-by: harshit-gangal <harshit@planetscale.com> * addressed review comments Signed-off-by: harshit-gangal <harshit@planetscale.com> --------- Signed-off-by: Harshit Gangal <harshit@planetscale.com> Signed-off-by: harshit-gangal <harshit@planetscale.com> Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
frouioui
pushed a commit
to planetscale/vitess
that referenced
this pull request
Apr 13, 2023
…itessio#12881) * fix: scoping rules for on clause expression inside a subquery Signed-off-by: Harshit Gangal <harshit@planetscale.com> * find the parent scope of the statement in on clause Signed-off-by: harshit-gangal <harshit@planetscale.com> * addressed review comments Signed-off-by: harshit-gangal <harshit@planetscale.com> --------- Signed-off-by: Harshit Gangal <harshit@planetscale.com> Signed-off-by: harshit-gangal <harshit@planetscale.com> Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
frouioui
pushed a commit
to planetscale/vitess
that referenced
this pull request
Apr 13, 2023
…itessio#12881) * fix: scoping rules for on clause expression inside a subquery Signed-off-by: Harshit Gangal <harshit@planetscale.com> * find the parent scope of the statement in on clause Signed-off-by: harshit-gangal <harshit@planetscale.com> * addressed review comments Signed-off-by: harshit-gangal <harshit@planetscale.com> --------- Signed-off-by: Harshit Gangal <harshit@planetscale.com> Signed-off-by: harshit-gangal <harshit@planetscale.com> Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
This was referenced Apr 13, 2023
frouioui
added a commit
that referenced
this pull request
Apr 14, 2023
…de a subquery (#12891) * planner fix: scoping rules for JOIN ON expression inside a subquery (#12881) * fix: scoping rules for on clause expression inside a subquery Signed-off-by: Harshit Gangal <harshit@planetscale.com> * find the parent scope of the statement in on clause Signed-off-by: harshit-gangal <harshit@planetscale.com> * addressed review comments Signed-off-by: harshit-gangal <harshit@planetscale.com> --------- Signed-off-by: Harshit Gangal <harshit@planetscale.com> Signed-off-by: harshit-gangal <harshit@planetscale.com> Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> * Fix plan test expectation for v3 Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> --------- Signed-off-by: Harshit Gangal <harshit@planetscale.com> Signed-off-by: harshit-gangal <harshit@planetscale.com> Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> Co-authored-by: Harshit Gangal <harshit@planetscale.com>
frouioui
added a commit
that referenced
this pull request
Apr 14, 2023
…12881) (#12889) * fix: scoping rules for on clause expression inside a subquery * find the parent scope of the statement in on clause * addressed review comments --------- Signed-off-by: Harshit Gangal <harshit@planetscale.com> Signed-off-by: harshit-gangal <harshit@planetscale.com> Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> Co-authored-by: Harshit Gangal <harshit@planetscale.com>
harshit-gangal
added a commit
that referenced
this pull request
Apr 18, 2023
…de a subquery (#12890) * planner fix: scoping rules for JOIN ON expression inside a subquery (#12881) * fix: scoping rules for on clause expression inside a subquery Signed-off-by: Harshit Gangal <harshit@planetscale.com> * find the parent scope of the statement in on clause Signed-off-by: harshit-gangal <harshit@planetscale.com> * addressed review comments Signed-off-by: harshit-gangal <harshit@planetscale.com> --------- Signed-off-by: Harshit Gangal <harshit@planetscale.com> Signed-off-by: harshit-gangal <harshit@planetscale.com> Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> * Fix plan test expectation for v3 Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> --------- Signed-off-by: Harshit Gangal <harshit@planetscale.com> Signed-off-by: harshit-gangal <harshit@planetscale.com> Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> Co-authored-by: Harshit Gangal <harshit@planetscale.com>
frouioui
pushed a commit
to planetscale/vitess
that referenced
this pull request
Nov 21, 2023
…pression inside a subquery (vitessio#1912) * cherry pick of 12881 * empty-commit to trigger CI Signed-off-by: Manan Gupta <manan@planetscale.com> --------- Signed-off-by: Manan Gupta <manan@planetscale.com> Co-authored-by: Manan Gupta <manan@planetscale.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Component: Query Serving
Type: Bug
Type: Enhancement
Logical improvement (somewhere between a bug and feature)
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
This PR updates the scoping rules for expressions involved in join table ON clauses, allowing them to use the scope of the SELECT statement's parent scope.
In MySQL 5.7, this scoping rule is not supported. However, MySQL 8.0 and later versions do support this functionality.
For example, consider the following query:
With the updated scoping rules, the join condition between t1 and t2 can now reference columns from t3, essentially allowing access to all columns available from the outer query.
Related Issue(s)
Checklist
Deployment Notes