PHOENIX-7921 Remove unread bookkeeping state from StatementContext - #2528
Merged
Conversation
Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Removes unused diagnostic/bookkeeping state from StatementContext and deletes the now-dead call sites that populated it, while preserving the existing rewrite breadcrumbs (appliedRewrites) used for EXPLAIN output.
Changes:
- Remove
indexExpressionSubstitutionstracking and related APIs fromStatementContext, plus the dead recorder call inIndexExpressionParseNodeRewriter. - Remove
liftedHavingNodes/addLiftedHavingNode()/isLiftedHavingNode()fromStatementContext, plus the dead recording loop inHavingCompiler. - Remove the unused
unionTags()helper fromStatementContext.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| phoenix-core-client/src/main/java/org/apache/phoenix/parse/IndexExpressionParseNodeRewriter.java | Drops the now-unused breadcrumbContext.addIndexExpressionSubstitution(...) call, leaving breadcrumb emission via addAppliedRewrite(...). |
| phoenix-core-client/src/main/java/org/apache/phoenix/compile/StatementContext.java | Deletes unused fields and methods (indexExpressionSubstitutions, liftedHavingNodes, unionTags) and removes their propagation via constructors/adoption. |
| phoenix-core-client/src/main/java/org/apache/phoenix/compile/HavingCompiler.java | Removes the loop that recorded lifted HAVING parse nodes, retaining the rewrite breadcrumb. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
Test ResultsUnit tests (
|
| Module | Tests | Failures | Errors | Skipped | Result |
|---|---|---|---|---|---|
| phoenix-core-client | 0 | 0 | 0 | 0 | no unit tests in module |
| phoenix-core-server | 0 | 0 | 0 | 0 | no unit tests in module |
| phoenix-core | 2580 | 0 | 0 | 9 | PASS |
All unit tests covering the modified code paths passed:
| Test class | Tests | Result |
|---|---|---|
query.explain.ExplainPlanTest |
105 | PASS |
query.explain.ExplainJsonOutputTest |
2 | PASS |
parse.ExplainOptionsParserTest |
16 | PASS |
compile.HavingCompilerTest |
11 | PASS |
compile.QueryOptimizerTest |
52 | PASS |
compile.WhereOptimizerTest |
138 | PASS |
compile.QueryCompilerTest |
215 | PASS |
Impacted integration tests (*IT)
Selected because they directly assert EXPLAIN output through the modified compile paths (functional/partial-index expression rewrite, HAVING-as-WHERE lift, derived-table flatten).
| IT class | Tests | Failures | Errors | Skipped | Time | Result |
|---|---|---|---|---|---|---|
end2end.ExplainPlanWithStatsDisabledIT |
17 | 0 | 0 | 0 | 73.9 s | PASS |
end2end.DerivedTableIT |
18 | 0 | 0 | 0 | 86.7 s | PASS |
end2end.ExplainPlanWithStatsEnabledIT |
30 | 0 | 0 | 0 | 101.6 s | PASS |
end2end.index.PartialIndexIT |
64 | 0 | 0 | 0 | 453.9 s | PASS |
| Total | 129 | 0 | 0 | 0 | — | BUILD SUCCESS |
apurtell
added a commit
to apurtell/phoenix
that referenced
this pull request
Jun 17, 2026
…pache#2528) 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
…2528) 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
…pache#2528) 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 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.
Remove unused bookkeeping from
StatementContext. DropsunionTags,addLiftedHavingNode(),isLiftedHavingNode()and the backingliftedHavingNodesset (the HAVING-lift breadcrumb is still emitted as aREWRITE HAVING PREDICATE AS WHEREline viaappliedRewrites), andaddIndexExpressionSubstitution()/getIndexExpressionSubstitutions()and the backingindexExpressionSubstitutionslist. Removes the corresponding fields, their entries in the copy constructor, the no-arg-init constructor, andadoptRewriteState, plus the now-deadbreadcrumbContext.addIndexExpressionSubstitution()call inIndexExpressionParseNodeRewriterand theaddLiftedHavingNodeloop inHavingCompiler. No behavior change. EXPLAIN text and JSON output are unchanged.