18369 backport to v22 branch#227
Merged
Merged
Conversation
* Set parsed comments in operator for subqueries (vitessio#18369) Signed-off-by: David Piegza <davidpiegza@github.com> * rerun ci Signed-off-by: Mohamed Hamza <mhamza15@github.com> * remove skip_e2e Signed-off-by: Mohamed Hamza <mhamza15@github.com> * fix test cases --------- Signed-off-by: David Piegza <davidpiegza@github.com> Signed-off-by: Mohamed Hamza <mhamza15@github.com> Co-authored-by: David Piegza <697113+davidpiegza@users.noreply.github.com>
alexisjcarr
approved these changes
Jun 4, 2026
thesnowrose
approved these changes
Jun 4, 2026
There was a problem hiding this comment.
Pull request overview
Backport of upstream Vitess PR vitessio#18369 to ensure planner preserves SQL comments when subqueries are merged into a single Route, backed by new plan testcases.
Changes:
- Add plan test coverage for comment preservation with mergeable and non-mergeable subqueries.
- Preserve
Route.Commentswhen merging a subquery into an outer route.
Show a summary per file
| File | Description |
|---|---|
| go/vt/vtgate/planbuilder/testdata/select_cases.json | Adds testcases asserting comments remain present in planned queries involving subqueries. |
| go/vt/vtgate/planbuilder/operators/subquery_planning.go | Copies outer route comments onto the merged route during subquery merge. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
Comment on lines
+554
to
+556
| if outer.Comments != nil { | ||
| op.Comments = outer.Comments | ||
| } |
The backport of upstream PR vitessio#18369 dropped the Type field from both new test cases in select_cases.json. The v22 planner still emits this field, so the tests were failing with a diff on Type: Scatter and Type: Complex respectively. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Andy Edison <andyedison@github.com>
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
this is a backport of vitessio#18369
we still need this as it was discovered v22 upstream still doesn't have this applied when we found comments were removed in our testing of plans https://github.com/github/vitess/issues/1560#issuecomment-4613797538
Related Issue(s)
Checklist
Deployment Notes