Copilot commented on code in PR #2505:
URL: https://github.com/apache/phoenix/pull/2505#discussion_r3382430360


##########
phoenix-core-client/src/main/java/org/apache/phoenix/iterate/ExplainTable.java:
##########
@@ -178,6 +187,53 @@ protected void explain(String prefix, List<String> 
planSteps,
         explainPlanAttributesBuilder.setKeyRanges(appendKeyRanges());
       }
     }
+
+    PTable.IndexType indexType = tableRef.getTable().getIndexType();
+    String explainIndexName = tableRef.getTable().getName().getString();
+    if (
+      indexType == PTable.IndexType.LOCAL && 
tableRef.getTable().getViewIndexId() != null
+        && 
explainIndexName.contains(QueryConstants.CHILD_VIEW_INDEX_NAME_SEPARATOR)
+    ) {
+      int lastIndexOf =
+        
explainIndexName.lastIndexOf(QueryConstants.CHILD_VIEW_INDEX_NAME_SEPARATOR);
+      explainIndexName = explainIndexName.substring(lastIndexOf + 1);
+    }

Review Comment:
   The logic that strips child view local-index names (based on viewIndexId + 
CHILD_VIEW_INDEX_NAME_SEPARATOR) is duplicated here and earlier when building 
the scan's "OVER" tableName. Duplicating this string-parsing in two places 
makes it easy for future changes to drift and produce inconsistent EXPLAIN 
output.
   
   Consider extracting a small helper (e.g., `getExplainIndexName(PTable 
table)` or `stripChildViewLocalIndexSuffixIfPresent(...)`) and using it for 
both the scan-line local-index decoration and this per-scan `INDEX` line.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to