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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathExpressionCollector.java:
##########
@@ -313,6 +342,14 @@ public Void visitElementAt(ElementAt elementAt, 
CollectorContext context) {
                 return continueCollectAccessPath(first, context);
             }
             return visit(elementAt, context);
+        } else if (first.getDataType().isVariantType() && arguments.size() >= 
2) {
+            CollectorContext variantRootContext = context.copy();
+            variantRootContext.setCollectVariantRoot(true);

Review Comment:
   This still does not force a full VARIANT read when the dynamic subscript has 
an outer suffix. For `v[cast(id AS string)]['x']`, the outer literal access 
leaves `accessPathBuilder = [x]`; this branch sets `collectVariantRoot`, but 
`visitSlotReference()` checks the non-empty builder first and records `[v, x]` 
instead of a root `[v]` demand. Since the dynamic key can select any top-level 
field before applying `['x']`, pruning to only `x` can drop required data and 
return missing/null values when combined with a sibling predicate such as 
`v['k'] IS NOT NULL`. Please clear/override the suffix when a dynamic VARIANT 
subscript requires a root read, or make `collectVariantRoot` take precedence 
over a non-empty builder, and add coverage for a chained dynamic subscript plus 
a sibling nested predicate.



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