Skip to content

PHOENIX-7882 Per scan EXPLAIN output improvements - #2505

Merged
apurtell merged 3 commits into
apache:PHOENIX-7876-featurefrom
apurtell:PHOENIX-7882
Jun 9, 2026
Merged

PHOENIX-7882 Per scan EXPLAIN output improvements#2505
apurtell merged 3 commits into
apache:PHOENIX-7876-featurefrom
apurtell:PHOENIX-7882

Conversation

@apurtell

Copy link
Copy Markdown
Contributor

Per-scan INDEX <name> [<kind>], SALT BUCKETS <n>, REGIONS PLANNED <n>.

ExplainTable.explain(...) emits INDEX before ROW TIMESTAMP FILTER (name from tableRef.getTable().getName(). Local indexes print just <idx>), with a <kind> token (LOCAL / GLOBAL / UNCOVERED GLOBAL) when the target is an INDEX, SALT BUCKETS when getBucketNum() is set, and REGIONS PLANNED from the split count.

Adds getSplitCount() to BaseResultIterators and indexName, indexKind, saltBuckets, regionsPlanned to ExplainPlanAttributes.

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

CopilotAI 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

This PR enhances Phoenix per-scan EXPLAIN output by adding consistent, structured scan metadata (index name/kind, salt buckets, and planned region/split count) to both the rendered plan text and the structured ExplainPlanAttributes, along with corresponding test and normalizer updates.

Changes:

  • Emit per-scan INDEX <name> [<kind>], SALT BUCKETS <n>, and REGIONS PLANNED <n> lines in ExplainTable.explain(...), and plumb split count via BaseResultIterators.getSplitCount().
  • Extend ExplainPlanAttributes (and builder) with indexName, indexKind, saltBuckets, and regionsPlanned.
  • Update unit/integration tests and explain normalizers to account for the new output (including normalizing variable region counts).

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
phoenix-core-client/src/main/java/org/apache/phoenix/iterate/ExplainTable.javaAdds per-scan INDEX/SALT BUCKETS/REGIONS PLANNED emission and populates new explain attributes.
phoenix-core-client/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.javaSupplies split count for the new REGIONS PLANNED line via getSplitCount().
phoenix-core-client/src/main/java/org/apache/phoenix/compile/ExplainPlanAttributes.javaAdds new structured fields + builder wiring and JSON property ordering.
phoenix-core/src/test/java/org/apache/phoenix/query/explain/ExplainPlanTest.javaUpdates expected explain text and JSON shapes; adds coverage for index kind tokens.
phoenix-core/src/test/java/org/apache/phoenix/query/explain/ExplainPlanTestUtil.javaExtends fluent assertions for the newly added structured explain attributes.
phoenix-core/src/test/java/org/apache/phoenix/query/explain/ExplainTextNormalizer.javaNormalizes the variable REGIONS PLANNED <n> count for stable comparisons.
phoenix-core/src/test/java/org/apache/phoenix/query/explain/ExplainJsonNormalizer.javaNulls regionsPlanned during normalization to avoid environment-dependent diffs.
phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinMoreIT.javaFormatting-only adjustments to keep tests aligned with updated output/style.
phoenix-core/src/it/java/org/apache/phoenix/end2end/join/SortMergeJoinLocalIndexIT.javaFormatting-only adjustments.
phoenix-core/src/it/java/org/apache/phoenix/end2end/join/SortMergeJoinGlobalIndexIT.javaFormatting-only adjustments.
phoenix-core/src/it/java/org/apache/phoenix/end2end/Bson3IT.javaFormatting-only adjustments.
phoenix-core/src/it/java/org/apache/phoenix/end2end/Bson4IT.javaFormatting-only adjustments.
phoenix-core/src/it/java/org/apache/phoenix/end2end/Bson5IT.javaFormatting-only adjustments.
phoenix-core-client/src/main/java/org/apache/phoenix/expression/util/bson/UpdateExpressionUtils.javaWraps a long log statement line for style/line-length compliance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@apurtell

Copy link
Copy Markdown
ContributorAuthor

Test Results

Unit tests (surefire)

TestResult
ExplainPlanTest62 run, 0 failures
QueryPlanTest4 run, 0 failures
QueryCompilerTest215 run, 0 failures (2 skipped)
QueryOptimizerTest49 run, 0 failures (1 skipped)

Integration tests (failsafe, forks=2)

TestResult
Bson4IT32 run, 0 failures (6 skipped)
Bson5IT2 run, 0 failures
SortMergeJoinMoreIT10 run, 0 failures
SortMergeJoinGlobalIndexIT35 run, 0 failures
SortMergeJoinLocalIndexIT35 run, 0 failures
ExplainPlanWithStatsEnabledIT28 run, 0 failures
ExplainPlanWithStatsDisabledIT17 run, 0 failures

The IT selection covers the five test files modified on the branch plus the two explain-focused ITs that exercise the changed client code.

@apurtell
apurtell merged commit 53da985 into apache:PHOENIX-7876-featureJun 9, 2026
@apurtell
apurtell deleted the PHOENIX-7882 branch June 9, 2026 19:02
asf-gitbox-commits pushed a commit that referenced this pull request Jun 10, 2026
Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>
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>
Sign up for freeto 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

@apurtell