DM-55975: Czar-level EXPLAIN support for xrd branch - #1089
Open
malensek wants to merge 6 commits into
Open
Conversation
Each of these isX() helper functions are called by UserQueryFactory (sometimes multiple calls) and carried a TRACE-level log that resulted in the function name and query string being printed repeatedly. Since the information is already printed at the DEBUG level (both the query string and how it ends up being handled), these can be safely removed.
ScanTableInfo was previously used on both sides of the aisle between the front-end query analysis layer and the back-end worker dispatch. This separates them into two distinct versions to avoid dependencies reaching across the aisle.
This chunk coverage computation already relied on several parts of QuerySession, and relocating it allows us to use it both during construction of SELECT queries as well as EXPLAIN queries.
This includes a new query type for czar-level EXPLAIN support and the required plumbing to execute it. Since this version of EXPLAIN only runs on the czar, it calculates a variety of query information accessible there, such as the scan rating and number of chunks that will be involved in the query being analyzed. Note that this does *NOT* dispatch EXPLAIN queries to the workers for analysis downstream from the czar.
These tests exercise the syntax surrounding EXPLAIN queries, which is handled in UserQueryFactory and detected via regex.
malensek
force-pushed
the
tickets/DM-55975
branch
from
August 27, 2026 21:26
9031ebc to
7a393b5
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds czar-level EXPLAIN support for SELECT queries on the xrd branch.
Changes:
- Adds traditional and JSON EXPLAIN parsing and result generation.
- Separates query-layer scan metadata from dispatch metadata.
- Reuses chunk analysis for SELECT and EXPLAIN paths.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/query/ScanTableInfo.h |
Defines query-layer scan metadata. |
src/query/QueryContext.h |
Uses query-layer scan metadata. |
src/qproc/QuerySession.h |
Exposes chunk and scan analysis APIs. |
src/qproc/QuerySession.cc |
Implements reusable chunk setup and metadata conversion. |
src/qana/ScanTablePlugin.h |
Adopts query-layer scan types. |
src/qana/ScanTablePlugin.cc |
Populates query scan metadata. |
src/proxy/test.sh |
Adds proxy EXPLAIN commands. |
src/proxy/mysqlProxy.lua |
Allows EXPLAIN forwarding. |
src/proto/ScanTableInfo.h |
Converts query metadata for dispatch. |
src/css/ScanTableParams.h |
Updates scan-rating documentation. |
src/ccontrol/UserQueryType.h |
Declares EXPLAIN recognition. |
src/ccontrol/UserQueryType.cc |
Parses EXPLAIN formats. |
src/ccontrol/UserQuerySelect.cc |
Delegates chunk setup to QuerySession. |
src/ccontrol/UserQueryFactory.cc |
Builds and routes EXPLAIN queries. |
src/ccontrol/UserQueryExplain.h |
Defines the EXPLAIN query implementation. |
src/ccontrol/UserQueryExplain.cc |
Produces tabular or JSON results. |
src/ccontrol/testUserQueryType.cc |
Tests EXPLAIN classification. |
src/ccontrol/CMakeLists.txt |
Builds the new implementation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+37
to
+38
| mysql --port=4040 --protocol=TCP proxyTest -e "explain select * from Obj" | ||
| mysql --port=4040 --protocol=TCP proxyTest -e "explain format=json select * from Obj" |
Member
Author
There was a problem hiding this comment.
My understanding is that script is just there for manual checking, not really part of integration coverage. But someone please correct me if I am wrong!
malensek
marked this pull request as ready for review
August 28, 2026 22:39
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 based on #1086, and adds EXPLAIN support to the xrd branch.
It is largely similar to the version for main, but previously,
ScanTableInfowas shared across the query and dispatch layers, which was the source of some recent conflicts between these branches. A newquery::ScanTableInfowas added to separate concerns between these sets of modules, and a few helper functions were also added to provideEXPLAINwith needed metadata.