Skip to content

PHOENIX-7921 Remove unread bookkeeping state from StatementContext - #2528

Merged
apurtell merged 1 commit into
apache:PHOENIX-7876-featurefrom
apurtell:PHOENIX-7921
Jun 14, 2026
Merged

PHOENIX-7921 Remove unread bookkeeping state from StatementContext#2528
apurtell merged 1 commit into
apache:PHOENIX-7876-featurefrom
apurtell:PHOENIX-7921

Conversation

@apurtell

Copy link
Copy Markdown
Contributor

Remove unused bookkeeping from StatementContext. Drops unionTags, addLiftedHavingNode(), isLiftedHavingNode() and the backing liftedHavingNodes set (the HAVING-lift breadcrumb is still emitted as a REWRITE HAVING PREDICATE AS WHERE line via appliedRewrites), and addIndexExpressionSubstitution() / getIndexExpressionSubstitutions() and the backing indexExpressionSubstitutions list. Removes the corresponding fields, their entries in the copy constructor, the no-arg-init constructor, and adoptRewriteState, plus the now-dead breadcrumbContext.addIndexExpressionSubstitution() call in IndexExpressionParseNodeRewriter and the addLiftedHavingNode loop in HavingCompiler. No behavior change. EXPLAIN text and JSON output are unchanged.

Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 indexExpressionSubstitutions tracking and related APIs from StatementContext, plus the dead recorder call in IndexExpressionParseNodeRewriter.
  • Remove liftedHavingNodes / addLiftedHavingNode() / isLiftedHavingNode() from StatementContext, plus the dead recording loop in HavingCompiler.
  • Remove the unused unionTags() helper from StatementContext.

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.

@apurtell

Copy link
Copy Markdown
Contributor Author

Test Results

Unit tests (*Test) — full reactor

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
apurtell merged commit 66be274 into apache:PHOENIX-7876-feature Jun 14, 2026
@apurtell
apurtell deleted the PHOENIX-7921 branch June 14, 2026 00:40
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants