github-actions[bot] commented on code in PR #63192:
URL: https://github.com/apache/doris/pull/63192#discussion_r3254013908


##########
fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/PruneNestedColumnTest.java:
##########
@@ -183,6 +199,65 @@ public void testVariantAccessPath() throws Exception {
         );
     }
 
+    @Test
+    public void testNestedVariantInsideStructCollectsSubPath() throws 
Exception {
+        StructType structWithVariant = new StructType(ImmutableList.of(
+                new StructField("v", VariantType.INSTANCE, true, ""),
+                new StructField("i", IntegerType.INSTANCE, true, "")));
+        SlotReference slot = new SlotReference("s", structWithVariant, true);
+        Expression expression = new ElementAt(
+                new StructElement(slot, new VarcharLiteral("v")),
+                new VarcharLiteral("metric"));
+
+        LinkedHashMultimap<Integer, CollectAccessPathResult> slotToAccessPaths 
=
+                LinkedHashMultimap.create();
+        AccessPathExpressionCollector collector =
+                new AccessPathExpressionCollector(null, slotToAccessPaths, 
false);
+        collector.collect(expression);
+
+        Assertions.assertEquals(ImmutableList.of(new CollectAccessPathResult(
+                        ImmutableList.of("s", "v", "metric"), false, 
ColumnAccessPathType.DATA)),
+                
ImmutableList.copyOf(slotToAccessPaths.get(slot.getExprId().asInt())));
+    }
+
+    @Test
+    public void testVariantInsideNamedStructConstructorDropsStructPrefix() 
throws Exception {
+        SlotReference slot = new SlotReference("v", VariantType.INSTANCE, 
true);
+        Expression expression = new ElementAt(

Review Comment:
   These constructor-based VARIANT tests do not exercise a reachable SQL path. 
`CreateNamedStruct.checkLegalityBeforeTypeCoercion()` rejects any VARIANT value 
child with `named_struct does not support jsonb/variant type`, and 
`CreateStruct` has the same `struct does not support jsonb/variant type` guard, 
so a query cannot produce the `CreateNamedStruct(..., v)` or `CreateStruct(v)` 
shapes used here. The tests can therefore pass while the real access-path 
collector behavior for legal VARIANT expressions remains uncovered. Please 
replace these with legal SQL-level coverage, or adjust the analyzer support if 
VARIANT-in-struct constructors are intended to be reachable.



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