Skip to content

PHOENIX-7936 EXPLAIN the user's projection on server-driven mutation inner plans - #2545

Merged
apurtell merged 2 commits into
apache:PHOENIX-7876-featurefrom
apurtell:PHOENIX-7936
Jun 25, 2026
Merged

PHOENIX-7936 EXPLAIN the user's projection on server-driven mutation inner plans#2545
apurtell merged 2 commits into
apache:PHOENIX-7876-featurefrom
apurtell:PHOENIX-7936

Conversation

@apurtell

Copy link
Copy Markdown
Contributor

Server-side UPSERT SELECT and DELETE compile their inner scan as an aggregating SELECT COUNT(1) whose count reports how many rows were touched. Under EXPLAIN (VERBOSE) that internal rewrite leaked as a misleading PROJECT COUNT(1) line (and serverProject: ["COUNT(1)"] in JSON) on the inner scan rather than describing the mutation. ExplainTable factors the per-scan PROJECT naming into a reusable static projectedColumnNames(RowProjector) and adds overrideMutationProject, which rewrites the serverProject attribute with the user-facing projection for UPSERT SELECT and DELETE.

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

…inner plans
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 improves EXPLAIN (VERBOSE) output for server-side UPSERT SELECT and DELETE by preventing the internal SELECT COUNT(1) rewrite (used only to compute mutation row counts) from leaking into the inner scan’s reported PROJECT/serverProject, and instead surfacing a user-facing projection.

Changes:

  • Factored VERBOSE PROJECT rendering into reusable ExplainTable.projectedColumnNames(RowProjector).
  • Added ExplainTable.overrideMutationProject(...) to rewrite the inner plan’s PROJECT line and serverProject attributes for mutation plans.
  • Wired the rewrite into server-side mutation explain plans in UpsertCompiler and DeleteCompiler.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

FileDescription
phoenix-core-client/src/main/java/org/apache/phoenix/iterate/ExplainTable.javaFactors projection-name rendering and adds a helper to override mutation PROJECT/serverProject to be user-facing.
phoenix-core-client/src/main/java/org/apache/phoenix/compile/UpsertCompiler.javaApplies the mutation projection override so VERBOSE explain reflects the user’s SELECT projection for server-side UPSERT SELECT.
phoenix-core-client/src/main/java/org/apache/phoenix/compile/DeleteCompiler.javaApplies the mutation projection override so VERBOSE explain reflects the delete’s row-identity projection rather than the internal count.

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

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@apurtell
apurtell merged commit 7f4909a into apache:PHOENIX-7876-featureJun 25, 2026
@apurtell
apurtell deleted the PHOENIX-7936 branch June 25, 2026 01:56
asf-gitbox-commits pushed a commit that referenced this pull request Jul 24, 2026
…inner plans (#2545)
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
…inner plans (apache#2545)
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