You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "apurtell (via GitHub)" <gi...@apache.org> on 2026/06/14 06:11:57 UTC
[PR] PHOENIX-7923 Simplify EXPLAIN value classes [phoenix]
apurtell opened a new pull request, #2530:
URL: https://github.com/apache/phoenix/pull/2530
Simplify EXPLAIN value classes.
Replaces `ExplainPlanAttributes`' private zero args constructor and package private all args constructor with a private builder. Removes `ExplainTable.RegionBoundary` in favor of deduping `HRegionLocation`s in `getRegionLocationsForExplainPlan` via a `LinkedHashSet<String>`. Replaces `ExplainOptions.Builder`'s `regionsSet` / `verboseSet` companion booleans with an inline `EnumSet<Option>` in the grammar action. The nested `Builder` type goes away and the parser constructs `ExplainOptions` directly. No behavior change. EXPLAIN text and JSON output are unchanged.
Co-authored-by: Claude Opus 4.8[1m] <no...@anthropic.com>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] PHOENIX-7923 Simplify EXPLAIN value classes [phoenix]
Posted by "apurtell (via GitHub)" <gi...@apache.org>.
apurtell merged PR #2530:
URL: https://github.com/apache/phoenix/pull/2530
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] PHOENIX-7923 Simplify EXPLAIN value classes [phoenix]
Posted by "apurtell (via GitHub)" <gi...@apache.org>.
apurtell commented on PR #2530:
URL: https://github.com/apache/phoenix/pull/2530#issuecomment-4700902767
## Test Results
### Unit tests (`*Test`)
#### Directly impacted EXPLAIN unit tests (3 classes, 123 tests)
| Class | Tests | Failures | Errors | Skipped | Notes |
| --- | ---: | ---: | ---: | ---: | --- |
| `ExplainOptionsParserTest` | 16 | 0 | 0 | 0 | Covers every `EXPLAIN [(<opt>...)]` form including `(REGIONS, REGIONS)` duplicate-rejection and the legacy `WITH REGIONS` alias — exercises the new `EnumSet<ExplainOpt> seen` path. |
| `ExplainJsonOutputTest` | 2 | 0 | 0 | 0 | Covers `EXPLAIN (REGIONS, FORMAT JSON)` end-to-end JSON output — exercises `getDefaultExplainPlan()` (now seeded by `new ExplainPlanAttributesBuilder().build()`) and the regionLocations dedupe path. |
| `ExplainPlanTest` | 105 | 0 | 0 | 0 | The connectionless EXPLAIN-grammar baseline suite. Asserts grammar/JSON shape for every operator class — exercises the new builder-driven private `ExplainPlanAttributes` ctor on every test. |
#### Other unit tests touching `ExplainPlanAttributes` / `ExplainOptions` (9 classes, 315 tests)
| Class | Tests | Failures | Errors | Skipped |
| --- | ---: | ---: | ---: | ---: |
| `MergeSortResultIteratorTest` | 2 | 0 | 0 | 0 |
| `ConcatResultIteratorTest` | 2 | 0 | 0 | 0 |
| `JoinQueryCompilerTest` | 2 | 0 | 0 | 0 |
| `StatementHintsCompilationTest` | 4 | 0 | 0 | 0 |
| `QueryPlanTest` | 4 | 0 | 0 | 0 |
| `TenantSpecificViewIndexCompileTest` | 6 | 0 | 0 | 0 |
| `PhoenixSyncTableMapperTest` | 28 | 0 | 0 | 0 |
| `QueryOptimizerTest` | 52 | 0 | 0 | 1 |
| `QueryCompilerTest` | 215 | 0 | 0 | 2 |
### Integration tests (`*IT`)
#### Directly EXPLAIN-impacted ITs (2 classes, 37 tests)
| Class | Tests | Failures | Errors | Skipped | Time | Notes |
| --- | ---: | ---: | ---: | ---: | ---: | --- |
| `ExplainPlanWithStatsEnabledIT` | 30 | 0 | 0 | 0 | 50.8 s | Asserts EXPLAIN text/JSON output across all stats-enabled call sites — primary regression guard for `ExplainPlanAttributes` + plan-total estimate cells. |
| `QueryLoggerIT` | 7 | 0 | 0 | 0 | 47.4 s | Asserts the JDBC query-logger row matches `EXPLAIN` output, exercising the round-trip through `ExplainPlanAttributes`. |
#### Wider IT batch 1 — different EXPLAIN call sites (7 classes, 66 tests)
| Class | Tests | Failures | Errors | Skipped | Time |
| --- | ---: | ---: | ---: | ---: | ---: |
| `ClientHashAggregateIT` | 2 | 0 | 0 | 0 | 3.3 s |
| `ProjectArrayElemAfterHashJoinIT` | 2 | 0 | 0 | 0 | 2.5 s |
| `DistinctPrefixFilterIT` | 5 | 0 | 0 | 0 | 36.8 s |
| `UnionAllIT` | 19 | 0 | 0 | 0 | 73.6 s |
| `EmptyColumnIT` | 7 | 0 | 0 | 0 | 159.4 s |
| `TenantSpecificViewIndexIT` | 11 | 0 | 0 | 0 | 19.0 s |
| `CostBasedDecisionIT` | 20 | 0 | 0 | 0 | 160.5 s |
#### Wider IT batch 2 — joins, in-list, delete (4 classes, 370 tests)
| Class | Tests | Failures | Errors | Skipped | Time |
| --- | ---: | ---: | ---: | ---: | ---: |
| `SortMergeJoinNoIndexIT` | 35 | 0 | 0 | 0 | 13.1 s |
| `HashJoinNoIndexIT` | 33 | 0 | 0 | 0 | 15.4 s |
| `InListIT` | 228 | 0 | 0 | 0 | 145.1 s |
| `DeleteIT` | 74 | 0 | 0 | 0 | 205.6 s |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] PHOENIX-7923 Simplify EXPLAIN value classes [phoenix]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #2530:
URL: https://github.com/apache/phoenix/pull/2530#discussion_r3409104001
##########
phoenix-core-client/src/main/java/org/apache/phoenix/parse/ExplainOptions.java:
##########
@@ -79,49 +79,4 @@ public String toString() {
return "ExplainOptions{regions=" + regions + ", verbose=" + verbose + ", format=" + format
+ "}";
}
-
- /**
- * Mutable builder used by the parser to accumulate options as they are encountered in the option
- * list. Rejects duplicate options.
- */
- public static final class Builder {
- private boolean regions;
- private boolean regionsSet;
- private boolean verbose;
- private boolean verboseSet;
- private Format format;
-
- public Builder setRegions(boolean regions) {
- if (regionsSet) {
- throw new RuntimeException("Duplicate EXPLAIN option: REGIONS");
- }
- this.regions = regions;
- this.regionsSet = true;
- return this;
- }
-
- public Builder setVerbose(boolean verbose) {
- if (verboseSet) {
- throw new RuntimeException("Duplicate EXPLAIN option: VERBOSE");
- }
- this.verbose = verbose;
- this.verboseSet = true;
- return this;
- }
-
- public Builder setFormat(Format format) {
- if (format == null) {
- throw new RuntimeException("EXPLAIN option FORMAT requires a value: TEXT or JSON");
- }
- if (this.format != null) {
- throw new RuntimeException("Duplicate EXPLAIN option: FORMAT");
- }
- this.format = format;
- return this;
- }
-
- public ExplainOptions build() {
- return new ExplainOptions(regions, verbose, format == null ? Format.TEXT : format);
- }
- }
}
Review Comment:
Removing the public nested `ExplainOptions.Builder` is a source/binary-incompatible API change for any downstream code that may have been constructing `ExplainOptions` via the builder. If Phoenix client APIs aim to maintain compatibility across releases, consider keeping `Builder` as a deprecated wrapper that delegates to the `ExplainOptions` constructor and removing it in a major version instead.
##########
phoenix-core-client/src/main/java/org/apache/phoenix/iterate/ExplainTable.java:
##########
@@ -804,14 +803,13 @@ private String getRegionLocationsForExplainPlan(
}
try {
StringBuilder buf = new StringBuilder().append(REGION_LOCATIONS);
- Set<RegionBoundary> regionBoundaries = new HashSet<>();
+ Set<String> regionBoundaries = new LinkedHashSet<>();
List<HRegionLocation> regionLocations = new ArrayList<>();
for (HRegionLocation regionLocation : regionLocationsFromResultIterator) {
- RegionBoundary regionBoundary = new RegionBoundary(regionLocation.getRegion().getStartKey(),
- regionLocation.getRegion().getEndKey());
- if (!regionBoundaries.contains(regionBoundary)) {
+ String regionBoundary = Bytes.toStringBinary(regionLocation.getRegion().getStartKey()) + ":"
+ + Bytes.toStringBinary(regionLocation.getRegion().getEndKey());
Review Comment:
`regionBoundary` is built by concatenating two `Bytes.toStringBinary(...)` values with a ":" delimiter. Since `toStringBinary` can itself contain colons for printable bytes, different (startKey,endKey) pairs can collide to the same string (e.g. start="a:", end="b" vs start="a", end=":b"), causing incorrect de-duplication and potentially missing region locations in EXPLAIN output. Use a delimiter that cannot appear in `toStringBinary` output (e.g. NUL) or encode with length prefixes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org