Uh oh!
There was an error while loading. Please reload this page.
PHOENIX-7881 Refactor UTs and ITs to assert on ExplainPlanAttributes - #2503
Conversation
| return (useLongViewIndex ? (Long) s : (Short) s) + Short.MAX_VALUE + 2; | ||
| } | ||
| private static class RowKeyValueIterator implements Iterator<byte[]> { |
There was a problem hiding this comment.
This change is me removing some unused code I found.
There was a problem hiding this comment.
Pull request overview
Refactors Phoenix unit/integration tests to stop asserting against raw EXPLAIN text and instead assert against structured ExplainPlanAttributes via the fluent ExplainPlanTestUtil.assertPlan(...) API, while extending explain-plan attribute capture (e.g., client-side steps, join operands, sub-plans) to keep emitted text/JSON stable.
Changes:
- Migrated many UTs/ITs from string-based
EXPLAINassertions (QueryUtil.getExplainPlan(...)) to fluent attribute-based assertions. - Extended explain-plan attribute plumbing to capture ordered
clientSteps, richer join structure (lhs/rhs), and additional join/subplan-related attributes. - Updated explain normalizers (text/JSON) to accommodate new attribute shape and recursion paths.
Reviewed changes
Copilot reviewed 143 out of 143 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/ExplainPlanTextTest.java | Removed legacy text-only EXPLAIN test |
| phoenix-core/src/test/java/org/apache/phoenix/query/explain/ExplainTextNormalizer.java | Clarified normalizer comments |
| phoenix-core/src/test/java/org/apache/phoenix/query/explain/ExplainJsonNormalizer.java | Normalize new explain JSON fields/children |
| phoenix-core/src/test/java/org/apache/phoenix/compile/StatementHintsCompilationTest.java | Use assertPlan for hint explain assertions |
| phoenix-core/src/test/java/org/apache/phoenix/compile/QueryOptimizerTest.java | Use assertPlan for optimizer explain assertions |
| phoenix-core/src/test/java/org/apache/phoenix/compile/JoinQueryCompilerTest.java | Use assertPlan + subPlan assertions |
| phoenix-core/src/it/java/org/apache/phoenix/schema/ConditionalTTLExpressionIT.java | Use assertPlan for index usage checks |
| phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixServerRpcIT.java | Use assertPlan on prepared statements |
| phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixClientRpcIT.java | Use assertPlan on prepared statements |
| phoenix-core/src/it/java/org/apache/phoenix/monitoring/HBaseScanMetricsIT.java | Use assertPlan for scanned table |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/WhereOptimizerForArrayAnyNullablePKIT.java | Use assertPlan for index usage |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/WhereOptimizerForArrayAnyITBase.java | Use assertPlan for scan-type checks |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/WhereOptimizerForArrayAnyIT.java | Use assertPlan for scan-type checks |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewMetadataIT.java | Use assertPlan/getPlanSteps for index mention |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/VarBinaryEncoded2IT.java | Use assertPlan for index + scan type |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java | Use assertPlan for functional index plans |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectWithRegionMovesIT.java | Use assertMutationPlan for mutation explain |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java | Use assertMutationPlan for mutation explain |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/UnionAllIT.java | Assert union root + clientSteps + rhs |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/UCFWithDisabledIndexIT.java | Use assertPlan for scanned table |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificViewIndexIT.java | Use assertPlan for range scan plan |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java | Use assertPlan for point-lookup scan type |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java | Use assertPlan for hinted index usage |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/TableTTLIT.java | Use assertPlan for index vs data usage |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/SubBinaryFunctionIT.java | Use assertPlan for range-scan key ranges |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/SpillableGroupByIT.java | Use assertPlan for splits/scan/table |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinMoreIT.java | Use assertPlan with lhs()/rhs() navigation |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/ServerPagingIT.java | Use assertPlan for index table selection |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/SequenceIT.java | Use assertPlan for client sequence count |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/SequenceBulkAllocationIT.java | Use assertPlan for sequence explain assertions |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java | Use assertPlan for salted point lookups |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/BaseSaltedTableIT.java | Use assertPlan for order-by optimization |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/RTrimFunctionIT.java | Use assertPlan for range scan |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorOffsetIT.java | Use assertPlan for offset explain attributes |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorIT.java | Use assertPlan for skip-scan plan assertions |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/ReverseScanIT.java | Use assertPlan for reverse scan assertions |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithTableSampleIT.java | Use assertPlan for sampling-rate explains |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithOffsetIT.java | Use assertPlan for offset plan assertions |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithLimitIT.java | Use assertPlan for limit plan assertions |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryLoggerIT.java | Added comments re: logged EXPLAIN_PLAN |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/ProjectArrayElemAfterHashJoinIT.java | Use attributes + assertPlan for projection/subplans |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsDisabledWithRegionMovesIT.java | Removed legacy validateQueryPlan helper |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsDisabledIT.java | Removed legacy validateQueryPlan helper |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/OnDuplicateKeyIT.java | Use assertPlan + normalized index naming |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/OnDuplicateKey2IT.java | Use assertPlan for scanned table name |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/MultiCfQueryExecIT.java | Use assertPlan for FORWARD_SCAN sorting |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/MaxLookbackIT.java | Use assertPlan for index scan verification |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/MaxLookbackExtendedIT.java | Use assertPlan for index scan verification |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/LogicalTableNameIT.java | Use assertPlan; simplify join test wiring |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/LogicalTableNameExtendedIT.java | Use assertPlan; derive hinted index |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/LocalIndexSplitMergeIT.java | Use assertPlan for local index plans |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/KeyOnlyIT.java | Use assertPlan for limit plan assertions |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/json/JsonFunctionsIT.java | Use assertPlan for index/table/projection checks |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/join/SortMergeJoinNoSpoolingIT.java | Constructor signature aligned with base |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/join/SortMergeJoinNoIndexIT.java | Provide attribute-based join plan assertions |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/join/SortMergeJoinIT.java | Replace string plans with assertion hooks |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/join/SortMergeJoinGlobalIndexIT.java | Attribute-based assertions for global-index cases |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/join/BaseJoinIT.java | Removed string-plan translation/assertion helpers |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolForPartialBuildIT.java | Use assertPlan for data vs index scans |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java | Use assertPlan for mutable index checks |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexBuildTimestampIT.java | Use assertPlan for local/global index scans |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java | Use assertPlan for view-index plans |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/index/UncoveredGlobalIndexRegionScannerIT.java | Use assertPlan for scan/table selection |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/index/UncoveredGlobalIndexRegionScanner2IT.java | Use assertPlan for scan/table selection |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/TxWriteFailureIT.java | Use assertPlan for data/index scan asserts |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/index/SingleCellIndexIT.java | Use assertPlan for index usage asserts |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/index/PartialSystemCatalogIndexIT.java | Use assertPlan for SYSTEM.CATALOG explain |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java | Use assertPlan for failure/retry plan checks |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMaintenanceIT.java | Use assertPlan for local/global index scans |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexWithStatsIT.java | Use assertPlan for stats-related scan type |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java | Use assertPlan for view-index vs base-table |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseImmutableIndexIT.java | Use assertPlan for global immutable index scans |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/EmptyColumnIT.java | Use attributes to assert distinct prefix filter |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctPrefixFilterIT.java | Use attributes to assert distinct prefix filter |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java | Use assertPlan/assertMutationPlan for delete explain |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java | Use assertPlan for index usage asserts |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java | Use assertPlan for namespace-mapped table scans |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/CountDistinctApproximateHyperLogLogIT.java | Use assertPlan for aggregate scan assertions |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientHashAggregateIT.java | Use attributes to assert client hash aggregate |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/CDCQueryIT.java | Use attributes to assert CDC index not used |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/CastAndCoerceIT.java | Use assertPlan for range scan assertions |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/Bson5IT.java | Use assertPlan; add rawtype suppressions |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/Bson4IT.java | Use assertPlan for scan/table assertions |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java | Use assertPlan for view index plan assertions |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseTenantSpecificViewIndexIT.java | Use assertPlan for tenant view index plans |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java | Use assertPlan/attributes for index usage checks |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseOrderByWithRegionMovesIT.java | Use assertPlan for order-by optimization asserts |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseOrderByIT.java | Use assertPlan for order-by optimization asserts |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseAggregateWithRegionMovesIT.java | Use assertPlan for aggregate plan asserts |
| phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterSessionIT.java | Use assertPlan for consistency explain asserts |
| phoenix-core-client/src/main/java/org/apache/phoenix/iterate/SequenceResultIterator.java | Add clientSteps recording for sequence reserve |
| phoenix-core-client/src/main/java/org/apache/phoenix/iterate/SegmentResultIterator.java | Add clientSteps recording for segment scan |
| phoenix-core-client/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java | Add clientSteps recording for ordered iterator |
| phoenix-core-client/src/main/java/org/apache/phoenix/iterate/OffsetResultIterator.java | Add clientSteps recording for offset iterator |
| phoenix-core-client/src/main/java/org/apache/phoenix/iterate/MergeSortTopNResultIterator.java | Add clientSteps recording for merge sort/limit |
| phoenix-core-client/src/main/java/org/apache/phoenix/iterate/MergeSortRowKeyResultIterator.java | Add clientSteps recording for merge sort |
| phoenix-core-client/src/main/java/org/apache/phoenix/iterate/LimitingResultIterator.java | Add clientSteps recording for row limit |
| phoenix-core-client/src/main/java/org/apache/phoenix/iterate/FilterResultIterator.java | Add clientSteps recording for client filter |
| phoenix-core-client/src/main/java/org/apache/phoenix/iterate/FilterAggregatingResultIterator.java | Add clientSteps recording for client filter |
| phoenix-core-client/src/main/java/org/apache/phoenix/iterate/DistinctAggregatingResultIterator.java | Add clientSteps recording for distinct |
| phoenix-core-client/src/main/java/org/apache/phoenix/iterate/CursorResultIterator.java | Add clientSteps recording for cursor |
| phoenix-core-client/src/main/java/org/apache/phoenix/iterate/ExplainTable.java | Add regionLocationsTotalSize in attributes |
| phoenix-core-client/src/main/java/org/apache/phoenix/execute/TupleProjectionPlan.java | Add clientSteps recording for post-filter |
| phoenix-core-client/src/main/java/org/apache/phoenix/execute/SortMergeJoinPlan.java | Reshape explain attributes to synthetic join root |
| phoenix-core-client/src/main/java/org/apache/phoenix/execute/HashJoinPlan.java | Populate attributes for subPlans/filters/limits |
| phoenix-core-client/src/main/java/org/apache/phoenix/execute/ClientScanPlan.java | Record client steps in attributes |
| phoenix-core-client/src/main/java/org/apache/phoenix/execute/ClientAggregatePlan.java | Record client steps in attributes |
| phoenix-core-client/src/main/java/org/apache/phoenix/compile/GroupByCompiler.java | Populate serverGroupByLimit in attributes |
| phoenix-core-client/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java | Provide attributes for DELETE SINGLE ROW explain |
💡 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.
Updated with an accepted improvement suggested by Copilot and some test fixes. The issues were test issues introduced by the changes and do not change Phoenix query planning or function:
|
apurtell
commented
Jun 9, 2026
Test resultsScope
The only added runtime behavior is attribute population. Text rendering is byte-for-byte unchanged. Surefire (unit tests)
Failsafe (integration tests)Full impacted-IT surface = 94 concrete classes (
Zero EXPLAIN-assertion failures across the entire impacted surface. |
…2503) Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>
…pache#2503) Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>
…2503) Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>
…pache#2503) Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>
Refactor every IT and UT that asserted on
EXPLAINtext to use the new fluentExplainPlanTestUtil.assertPlanAPI overExplainPlanAttributes.Emitted text and JSON shape are unchanged. Coverage is preserved.
ExplainPlanAttributesis regrouped and gains an orderedclientStepslist pluslhsJoinQueryExplainPlan,subPlans,dynamicServerFilter,afterJoinFilter,joinScannerLimit,sortMergeSkipMerge,serverGroupByLimit,regionLocationsTotalSize, andnumRegionLocationLookups.SortMergeJoinPlan.getExplainPlan()is reshaped into a synthetic root carrying the join operator with separatelhsandrhschildren.HashJoinPlan.getExplainPlan()now populates attributes for sub-plans, post join filters, and scanner limits.ClientAggregatePlanandClientScanPlanplus the merge-sort, ordered, limiting, and offset iterators addclientStepsto plan explanation.ExplainPlanTestUtiladdslhs()andrhs()navigation and various new assertions such asclientStepCount,clientStep(i),clientSteps(...), and others.ExplainJsonNormalizerrecurses intolhs,rhs, andsubPlans.Co-authored-by: Claude Opus 4.8[1m] noreply@anthropic.com