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


##########
phoenix-core/src/test/java/org/apache/phoenix/query/explain/ExplainJsonNormalizer.java:
##########
@@ -91,11 +95,24 @@ private JsonNode normalize(JsonNode node, 
TempAliasRenumberer aliases) {
       obj.put(u.getKey(), u.getValue());
     }
 
+    JsonNode lhs = obj.get("lhsJoinQueryExplainPlan");
+    if (lhs != null && lhs.isObject()) {
+      normalize(lhs, aliases);
+    }
+
     JsonNode rhs = obj.get("rhsJoinQueryExplainPlan");
     if (rhs != null && rhs.isObject()) {
       normalize(rhs, aliases);
     }
 
+    JsonNode subPlans = obj.get("subPlans");
+    if (subPlans != null && subPlans.isArray()) {
+      ArrayNode subPlansArray = (ArrayNode) subPlans;
+      for (JsonNode subPlan : subPlansArray) {
+        normalize(subPlan);
+      }
+    }

Review Comment:
   `subPlans` normalization currently calls `normalize(subPlan)` which creates 
a new `TempAliasRenumberer` for each sub-plan. That breaks the stated behavior 
of keeping temp-alias renumbering consistent across the entire explain-plan 
tree and can make JSON comparisons flaky when the same temp alias appears in 
both the root and a sub-plan. Reuse the existing `aliases` instance by calling 
the private overload.



-- 
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