Skip to content

Conversation

@arthurschreiber
Copy link
Member

@arthurschreiber arthurschreiber commented Jan 13, 2026

Description

Various queries against information_schema tables were not being merged correctly.

This pull request contains multiple interlinked fixes:

Column offset map for UNION queries

The column offset map used for UNION queries was doing column name comparisons incorrectly. The offset map was built using the user provided column names, but lowercased column names were used during lookups into the map. Column names in MySQL are case insensitive, so we now lowercase both the values used for creating the map as well as looking up the offsets.

This affects not just information_schema UNION queries, but was noticed there because the schema for information_schema tables that ships with Vitess uses upper cased column names.

Add support for merging UNION queries targeting information_schema tables

JOIN operations against information_schema tables supported being merged if the LHS and RHS targeted the same data sources (e.g. if the same schemas or tables were queried). This logic was missing from the UNION merging implementation.

Fix information_schema merge ability rules (affects both JOIN and UNION merging)

Merging of information_schema routes was only possible if the table schema list of the LHS and the RHS of the merge matched fully (exact match of all values). This was artificially limiting the routes that could be merged, as the actual requirement is that the table schema lists only need to intersect (share one common value).


This also updated the planner debug output for DBA routes (used for information_schema queries) to include the SysTableTableSchema and SysTableTableName information to make it a bit easier to understand what's going on.

Related Issue(s)

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

AI Disclosure

@github-actions github-actions bot added this to the v24.0.0 milestone Jan 13, 2026
@vitess-bot vitess-bot bot added NeedsWebsiteDocsUpdate What it says NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Jan 13, 2026
@vitess-bot
Copy link
Contributor

vitess-bot bot commented Jan 13, 2026

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.88%. Comparing base (93e4601) to head (991dea5).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...gate/planbuilder/operators/info_schema_planning.go 18.75% 13 Missing ⚠️
go/vt/vtgate/planbuilder/operators/union.go 80.00% 1 Missing ⚠️
...o/vt/vtgate/planbuilder/operators/union_merging.go 95.83% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #19138   +/-   ##
=======================================
  Coverage   69.88%   69.88%           
=======================================
  Files        1613     1613           
  Lines      216019   216055   +36     
=======================================
+ Hits       150960   150999   +39     
+ Misses      65059    65056    -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arthurschreiber
Copy link
Member Author

#19139 contains a better approach / fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants