PHOENIX-7902 SERVER ARRAY|JSON|BSON PROJECTION counted forms in EXPLAIN - #2522
Conversation
Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates Phoenix EXPLAIN output to replace the prior opaque server-side projection markers with per-type, counted SERVER ARRAY|JSON|BSON PROJECTION <count> clauses, and includes one additional indented line per pushed-down path expression. It also updates explain-plan attribute plumbing and tests accordingly.
Changes:
- Emit
SERVER ARRAY|JSON|BSON PROJECTION <count>plus per-expression detail lines inExplainTable. - Plumb server-side parsed projection expressions through
StatementContextand expose them viaExplainPlanAttributesasserverParsedProjections. - Update unit/integration tests to assert the new explain text and attribute structure.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| phoenix-core-client/src/main/java/org/apache/phoenix/iterate/ExplainTable.java | Replaces old per-scan markers with per-type counted projection clauses and detail lines; populates new explain attributes. |
| phoenix-core-client/src/main/java/org/apache/phoenix/compile/StatementContext.java | Adds storage for server-parsed projection expressions so EXPLAIN can render details. |
| phoenix-core-client/src/main/java/org/apache/phoenix/compile/ProjectionCompiler.java | Stashes per-attribute server-parsed function expression buckets onto the statement context during compilation. |
| phoenix-core-client/src/main/java/org/apache/phoenix/compile/ExplainPlanAttributes.java | Retires serverArrayElementProjection and adds serverParsedProjections with builder support and defensive copying. |
| phoenix-core/src/test/java/org/apache/phoenix/query/explain/ExplainPlanTestUtil.java | Adds fluent assertions for serverParsedProjections and removes old array-element boolean assertion usage. |
| phoenix-core/src/test/java/org/apache/phoenix/query/explain/ExplainPlanTest.java | Updates expected explain text and expected JSON attributes; adds JSON/BSON projection coverage. |
| phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java | Updates compilation-plan assertions to use serverParsedProjections APIs. |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/ProjectArrayElemAfterHashJoinIT.java | Updates IT expectations to assert pushed-down array projection counts. |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/json/JsonFunctionsIT.java | Updates IT string assertions for the new JSON projection explain marker. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Test Results
Unit testsResult: The count rose from the previous baseline of 2537 to 2539 because two new connectionless cases were added to
The pre-existing Directly relevant unit classes:
Integration testsResult:
The behavior change touches three EXPLAIN code paths:
|
…IN (apache#2522) Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>
…IN (#2522) Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>
…IN (apache#2522) Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>
Replace the two opaque per-scan markers
SERVER ARRAY ELEMENT PROJECTIONandSERVER JSON FUNCTION PROJECTIONwith per-type clausesSERVER ARRAY PROJECTION <count>,SERVER JSON PROJECTION <count>, andSERVER BSON PROJECTION <count>, emitted only when at least one path expression of the corresponding type is pushed server side, and each followed by one indented detail line per expression viaExpression.toString()indented to the next level.ProjectionCompiler.compileSelectClausestashes the per-attribute expression buckets (theserverAttributeToFuncExpressionMapit already builds before scan serialization) onStatementContextasserverParsedProjections : Map<String, List<Expression>>keyed by scan attribute name.ExplainTable.explain(...)replaces the existing code with new code that processes "ARRAY", "JSON", and "BSON" buckets, emits the counted header, and the additional indented detail lines.ExplainPlanAttributesretires theserverArrayElementProjectionboolean and adds aserverParsedProjections: Map<String,List<String>>map, with up to three buckets ("ARRAY", "JSON", and "BSON" ) each holding aList<String>, with matchingExplainPlanTestUtilfluent assertion getters, setters, and testers.Co-authored-by: Claude Opus 4.8[1m] noreply@anthropic.com