PHOENIX-7937 Trim whitespace in EXPLAIN FORMAT JSON scan attributes#2546
Open
apurtell wants to merge 1 commit into
Open
PHOENIX-7937 Trim whitespace in EXPLAIN FORMAT JSON scan attributes#2546apurtell wants to merge 1 commit into
apurtell wants to merge 1 commit into
Conversation
Co-authored-by: Claude Opus 4.8[1m] <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR canonicalizes (trims) whitespace in scan-related string fields when populating ExplainPlanAttributes for EXPLAIN FORMAT JSON, while keeping the human-readable/text explain output unchanged.
Changes:
- Trim
explainScanTypebefore storing it inExplainPlanAttributes. - Trim
keyRangesbefore storing it inExplainPlanAttributes. - Update/adjust JSON-baseline expectations in
ExplainPlanTestto match the canonicalized output.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
phoenix-core/src/test/java/org/apache/phoenix/query/explain/ExplainPlanTest.java |
Updates expected JSON attributes to match trimmed/canonical scan attribute strings; trims inputs in helper used to build expected scan JSON. |
phoenix-core-client/src/main/java/org/apache/phoenix/iterate/ExplainTable.java |
Trims scan attribute string values (explainScanType, keyRanges) when populating ExplainPlanAttributes for JSON output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
344
to
351
| if (OrderBy.REV_ROW_KEY_ORDER_BY.equals(orderBy)) { | ||
| explainPlanAttributesBuilder.setClientSortedBy("REVERSE"); | ||
| } | ||
| explainPlanAttributesBuilder.setExplainScanType(scanTypeDetails); | ||
| explainPlanAttributesBuilder.setExplainScanType(scanTypeDetails.trim()); | ||
| explainPlanAttributesBuilder.setTableName(tableName); | ||
| if (!scanRanges.isPointLookup()) { | ||
| explainPlanAttributesBuilder.setKeyRanges(appendKeyRanges()); | ||
| explainPlanAttributesBuilder.setKeyRanges(appendKeyRanges().trim()); | ||
| } |
Comment on lines
1893
to
+1897
| private static ObjectNode scanAttrs(String scanType, String table, String keys) { | ||
| ObjectNode n = defaultAttrs(); | ||
| n.put("iteratorTypeAndScanSize", "PARALLEL <N>-WAY"); | ||
| n.put("consistency", "STRONG"); | ||
| n.put("explainScanType", scanType); | ||
| n.put("explainScanType", scanType.trim()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trim scan attribute string values before populating
ExplainPlanAttributes. Text plan is unchanged. The JSON field values are canonicalized.Co-authored-by: Claude Opus 4.8[1m] noreply@anthropic.com