VTGate: Route single-valued information_schema IN predicates like equality - #20973
Open
mattlord wants to merge 17 commits into
Open
VTGate: Route single-valued information_schema IN predicates like equality#20973mattlord wants to merge 17 commits into
mattlord wants to merge 17 commits into
Conversation
…quality Signed-off-by: Matt Lord <mattalord@gmail.com>
…e columns Signed-off-by: Matt Lord <mattalord@gmail.com>
… predicates Signed-off-by: Matt Lord <mattalord@gmail.com>
…time Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
…n error and changelog wording, add characterization pins
- planner: run the evalengine.Translate pre-check on a single-element IN's
tuple element before rewriting it to `=`, so an untranslatable element
(e.g. table_schema in (other_col)) leaves the IN untouched instead of
being cosmetically rewritten while extraction still fails
- engine: VT12001 message now covers both zero-length and multi-value
tuples ("other than one schema name")
- changelog: qualify the multi-value error sentence to the bound/normalized
IN list form
- testdata: pin untranslatable single-element IN (red before the planner
fix, green after), NOT IN (already correct), and non-routing-column
ListArg (already correct) in both info_schema80/57_cases.json
Signed-off-by: Matt Lord <mattalord@gmail.com>
Contributor
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #20973 +/- ##
===========================================
+ Coverage 69.67% 77.06% +7.39%
===========================================
Files 1614 553 -1061
Lines 216793 84400 -132393
===========================================
- Hits 151044 65046 -85998
+ Misses 65749 19354 -46395
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…e-name table_name lists Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
mattlord
force-pushed
the
i_s-single_element_in
branch
from
September 4, 2026 02:21
8b9a2cc to
7e88e30
Compare
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Comment on lines
+105
to
+106
| // The column's bind variable already carries a different value; a | ||
| // second one cannot share it, so this predicate stays a plain filter. |
Contributor
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The critical multi-schema database() routing case must be corrected before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Balanced
| } | ||
| // Multi-element schema lists are resolved at execution. table_name | ||
| // lists already work as pushed-down filters. | ||
| if !isSchema || !translates(rhs) || slices.ContainsFunc(rhs, func(e sqlparser.Expr) bool { return !shouldRewrite(e) }) { |
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
information_schemaqueries using anINpredicate ontable_schema/table_namebypassed schema-name routing entirely and silently returned empty or incomplete results — the query shape Rails now generates for all of its schema readers.The planner now treats a single-valued
INas the equality it is: a one-element literal list is unwrapped at plan time, and a bound list (what vtgate's normalizer produces — its length is unknown until execution) is extracted and resolved at execution time, where one value routes exactly like=and anything else fails with an explicitVT12001error instead of silently querying the wrong keyspace. Multi-valuetable_name INlists are deliberately left as pushed-down filters, since they already work correctly once the schema routes. No normalizer changes were needed, so one cached plan serves any list length.Related Issue(s)
Checklist
Deployment Notes
AI Disclosure
I used Claude with Fable5 for the work and Codex with GPT-5.6 for reviews.