Uh oh!
There was an error while loading. Please reload this page.
PHOENIX-7967 Contain explain diagnostic recording - #2582
Conversation
Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>
apurtell
commented
Jul 24, 2026
@palashc Your suggested change |
There was a problem hiding this comment.
Pull request overview
This PR contains compile-time diagnostic recording so it only runs for EXPLAIN (or when explicitly enabled in tests), reducing overhead for normal query compilation while preserving EXPLAIN VERBOSE attribution and optimizer decision reporting.
Changes:
- Introduces a
collectDiagnosticsflag onPhoenixStatementand snapshots it intoStatementContextto gate diagnostic-only recording. - Lazily allocates diagnostic maps/lists and no-ops diagnostic hooks (predicate origin tagging, breadcrumbs, ignored hints, rejected indexes) when recording is disabled.
- Updates test utilities and adds/adjusts tests to verify “plain compile = no diagnostics” vs “EXPLAIN-mode compile = diagnostics recorded”.
Reviewed changes
Copilot reviewed 11 out of 11 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/ExplainPlanTestUtil.java | Adds helper to compile with diagnostics temporarily enabled so tests can assert on inner plan attributes consistently with real EXPLAIN. |
| phoenix-core/src/test/java/org/apache/phoenix/query/explain/ExplainPlanTest.java | Updates an existing VERBOSE-origin test to enable diagnostics explicitly; adds tests asserting diagnostics are absent for plain compiles and present for EXPLAIN-style compiles. |
| phoenix-core/src/test/java/org/apache/phoenix/compile/QueryOptimizerTest.java | Enables diagnostic recording explicitly for a rewrite-state test now that diagnostics are off by default. |
| phoenix-core-client/src/main/java/org/apache/phoenix/schema/PTableImpl.java | Gates partial-index predicate origin tagging behind diagnostic recording. |
| phoenix-core-client/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java | Propagates/gates rewrite breadcrumbs and rejected-index capture based on diagnostic recording; avoids allocations/cost when disabled. |
| phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java | Adds collectDiagnostics flag and scopes it to EXPLAIN compilation via try/finally. |
| phoenix-core-client/src/main/java/org/apache/phoenix/compile/WhereCompiler.java | Skips WHERE origin tagging entirely when diagnostic recording is disabled. |
| phoenix-core-client/src/main/java/org/apache/phoenix/compile/StatementContext.java | Captures collectDiagnostics from the statement, gates recording APIs, and lazily allocates diagnostic-only maps. |
| phoenix-core-client/src/main/java/org/apache/phoenix/compile/RVCOffsetCompiler.java | Gates RVC-offset predicate origin tagging behind diagnostic recording. |
| phoenix-core-client/src/main/java/org/apache/phoenix/compile/JoinCompiler.java | Gates JOIN ON predicate origin tagging behind diagnostic recording. |
| phoenix-core-client/src/main/java/org/apache/phoenix/compile/HavingCompiler.java | Gates HAVING predicate origin tagging (and child iteration) behind diagnostic recording. |
💡 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.
palashc
commented
Jul 24, 2026
palashc
left a comment
There was a problem hiding this comment.
1 comment and InListIT test failures look relevant.
Uh oh!
There was an error while loading. Please reload this page.
palashc
left a comment
There was a problem hiding this comment.
+1, pending build results
https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-2582/2/
Co-authored-by: Claude Opus 4.8[1m] noreply@anthropic.com