Copilot commented on code in PR #63891:
URL: https://github.com/apache/doris/pull/63891#discussion_r3322283339


##########
fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/VariantPruningLogicTest.java:
##########
@@ -72,6 +72,24 @@ public void testVariantNumericIndexSubPath() throws 
Exception {
         );
     }
 
+    @Test
+    public void testVariantArraySubscriptUsesPrunedSubPath() throws Exception {
+        String sql = "select cast(v['items']['type'] as array<string>)[1] from 
variant_tbl";
+        String explain = getSQLPlanOrErrorMsg(sql, true);
+        Assertions.assertTrue(explain.contains("final projections: 
element_at(CAST(v AS array<text>), 1)"),
+                explain);
+        Assertions.assertTrue(explain.contains("subColPath=[items, type]"),
+                explain);
+        
Assertions.assertFalse(explain.contains("element_at(CAST(element_at(element_at("),
+                explain);

Review Comment:
   The unit test asserts an exact EXPLAIN substring (including the "final 
projections:" prefix and a concrete type spelling). EXPLAIN formatting/type 
rendering tends to change, so this makes the test unnecessarily brittle while 
still testing the same behavior. Consider loosening the match to just the key 
structural parts: that the projection is `element_at(CAST(v AS array<...>), 
1)`, that the scan slot has `subColPath=[items, type]`, and that there is no 
`CAST(element_at(...))` chain left after pruning.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to