Uh oh!
There was an error while loading. Please reload this page.
PHOENIX-7924 EXPLAIN improvement bug fixes - #2531
Merged
Merged
Conversation
Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses multiple EXPLAIN output correctness issues discovered while generating EXPLAIN/VERBOSE/JSON examples: typed-null literal rendering, functional index column name whitespace, and missing functional-index rewrite breadcrumbs by deferring breadcrumb emission until after the winning plan is chosen.
Changes:
- Fix
LiteralExpression.toString()so typed-null literals render asnull(avoids empty trailing arguments in function strings). - Trim top-level functional index expression SQL when creating index column names to avoid leading whitespace being persisted into
PColumnnames. - Capture functional-index substitution pairs on
StatementContextand emit one rewrite breadcrumb per actually-applied substitution for the chosen plan inQueryOptimizer.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| phoenix-core/src/test/java/org/apache/phoenix/query/explain/ExplainPlanTest.java | Updates expected EXPLAIN JSON/text output for BSON_VALUE to include null for typed-null default argument. |
| phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java | Trims serialized functional index expressions before building index column names to prevent leading whitespace in names. |
| phoenix-core-client/src/main/java/org/apache/phoenix/parse/IndexExpressionParseNodeRewriter.java | Stops eagerly emitting rewrite breadcrumbs during candidate enumeration; retains constructor for compatibility and keeps substitution tracking. |
| phoenix-core-client/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java | Records substitution pairs during rewrite and emits rewrite breadcrumbs only for the winner plan. |
| phoenix-core-client/src/main/java/org/apache/phoenix/expression/LiteralExpression.java | Renders typed-null literals as "null" instead of an empty string. |
| phoenix-core-client/src/main/java/org/apache/phoenix/compile/StatementContext.java | Adds storage/accessors for applied functional-index substitution pairs to support winner-only breadcrumb emission. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
apurtell added a commit
to apurtell/phoenix
that referenced
this pull request
Jun 17, 2026
Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>
asf-gitbox-commits pushed a commit
that referenced
this pull request
Jul 24, 2026
Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>
apurtell added a commit
to apurtell/phoenix
that referenced
this pull request
Aug 4, 2026
Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.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 freeto 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.
Three fixes for bugs discovered while generating EXPLAIN/EXPLAIN VERBOSE/EXPLAIN JSON examples.
LiteralExpression.toString()rendered typed-null literals as empty. Output now showsBSON_VALUE(..., null)instead ofBSON_VALUE(..., ).Leading whitespace was baked into functional index column names. Fixed by trimming at creation. Output now shows
PROJECT "BSON_VALUE(...)"instead ofPROJECT " BSON_VALUE(...)".REWRITE INDEX EXPRESSION <expr> AS <index col>breadcrumb was missing because it was always silently dropped. Drop the eager emission, store the col to expr substitution pairs onStatementContext, and emit one breadcrumb per actually fired substitution fromQueryOptimizer.recordDecision.Co-authored-by: Claude Opus 4.8[1m] noreply@anthropic.com