Set parsed comments in operator for subqueries (#18369)#177
Merged
mhamza15 merged 5 commits intorelease-21.0-githubfrom Sep 3, 2025
Merged
Set parsed comments in operator for subqueries (#18369)#177mhamza15 merged 5 commits intorelease-21.0-githubfrom
mhamza15 merged 5 commits intorelease-21.0-githubfrom
Conversation
Signed-off-by: David Piegza <davidpiegza@github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR addresses an issue where SQL comments are not properly preserved when subqueries are merged with their outer queries during query planning. The change ensures that comments from the outer query are retained in the merged operator.
- Adds logic to preserve comments when merging subqueries with outer queries
- Includes test cases demonstrating 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 | Adds comment preservation logic in the tryMergeSubqueryWithOuter function |
| go/vt/vtgate/planbuilder/testdata/select_cases.json | Adds test cases verifying comment handling with subqueries |
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