Set parsed comments in operator for subqueries (#18369)#174
Merged
arthurschreiber merged 9 commits intorelease-20.0-githubfrom Aug 7, 2025
Merged
Set parsed comments in operator for subqueries (#18369)#174arthurschreiber merged 9 commits intorelease-20.0-githubfrom
arthurschreiber merged 9 commits intorelease-20.0-githubfrom
Conversation
Signed-off-by: David Piegza <davidpiegza@github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR implements proper comment preservation when merging subqueries with outer queries in Vitess's query planner. The change ensures that SQL comments from the original query are retained in the merged operator when subqueries are consolidated into a single route.
Key changes:
- Added logic to preserve comments when merging subqueries with outer queries
- Added test cases to verify comment preservation in both merged and non-merged subquery scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| go/vt/vtgate/planbuilder/operators/subquery_planning.go | Added comment preservation logic in the subquery merge function |
| go/vt/vtgate/planbuilder/testdata/select_cases.json | Added test cases for comment handling with subqueries |
| "user.user" | ||
| ] | ||
| }, | ||
| "skip_e2e": true |
There was a problem hiding this comment.
This skip_e2e attribute does not exist on v21 yet, so you might have to remove this here and in the other test case. This is causing the unit test failure:
--- FAIL: TestPlanTestSuite/TestPlan/select_cases.json (0.00s)
panic: json: unknown field "skip_e2e" [recovered]
panic: json: unknown field "skip_e2e"
goroutine 1042 [running]:
testing.tRunner.func1.2({0x16b53c0, 0xc00074a6f0})
/opt/hostedtoolcache/go/1.22.12/x64/src/testing/testing.go:1631 +0x24a
testing.tRunner.func1()
/opt/hostedtoolcache/go/1.22.12/x64/src/testing/testing.go:1634 +0x377
panic({0x16b53c0?, 0xc00074a6f0?})
/opt/hostedtoolcache/go/1.22.12/x64/src/runtime/panic.go:770 +0x132
vitess.io/vitess/go/vt/vtgate/planbuilder.readJSONTests({0x18f7525, 0x11})
/home/runner/work/vitess-gh/vitess-gh/go/vt/vtgate/planbuilder/plan_test.go:724 +0xf0
vitess.io/vitess/go/vt/vtgate/planbuilder.(*planTestSuite).testFile.func1(0xc0007731e0)
/home/runner/work/vitess-gh/vitess-gh/go/vt/vtgate/planbuilder/plan_test.go:658 +0x8d
testing.tRunner(0xc0007731e0, 0xc000760200)
/opt/hostedtoolcache/go/1.22.12/x64/src/testing/testing.go:1689 +0xfb
created by testing.(*T).Run in goroutine 250
/opt/hostedtoolcache/go/1.22.12/x64/src/testing/testing.go:1742 +0x390
FAIL vitess.io/vitess/go/vt/vtgate/planbuilder 1.095s
Signed-off-by: Mohamed Hamza <mhamza15@github.com>
Signed-off-by: Mohamed Hamza <mhamza15@github.com>
Fix formatting for table entries in select_cases.json
arthurschreiber
approved these changes
Aug 7, 2025
Signed-off-by: Mohamed Hamza <mhamza15@github.com>
Signed-off-by: Mohamed Hamza <mhamza15@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.
This is a backport of vitessio#18369
Description
Related Issue(s)
Checklist
Deployment Notes