Skip to content

PHOENIX-7937 Trim whitespace in EXPLAIN FORMAT JSON scan attributes#2546

Open
apurtell wants to merge 1 commit into
apache:PHOENIX-7876-featurefrom
apurtell:PHOENIX-7937
Open

PHOENIX-7937 Trim whitespace in EXPLAIN FORMAT JSON scan attributes#2546
apurtell wants to merge 1 commit into
apache:PHOENIX-7876-featurefrom
apurtell:PHOENIX-7937

Conversation

@apurtell

Copy link
Copy Markdown
Contributor

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

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

Copilot AI 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 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 explainScanType before storing it in ExplainPlanAttributes.
  • Trim keyRanges before storing it in ExplainPlanAttributes.
  • Update/adjust JSON-baseline expectations in ExplainPlanTest to 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());
Sign up for free to 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