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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathPlanCollector.java:
##########
@@ -233,11 +245,17 @@ public Void visitLogicalProject(LogicalProject<? extends 
Plan> project, Statemen
         for (NamedExpression output : project.getProjects()) {
             // e.g. select struct_element(s, 'city') from (select s from tbl)a;
             // we will not treat the inner `s` access all path
-            if (output instanceof Slot && 
allSlotToAccessPaths.containsKey(output.getExprId().asInt())) {
+            if (collectWholeVariantOutputEnabled && output instanceof Slot
+                    && collectWholeVariantOutput((Slot) output)) {
+                continue;
+            } else if (output instanceof Slot && 
allSlotToAccessPaths.containsKey(output.getExprId().asInt())) {
                 continue;
             } else if (output instanceof Alias && output.child(0) instanceof 
Slot
                     && 
allSlotToAccessPaths.containsKey(output.getExprId().asInt())) {
                 Slot innerSlot = (Slot) output.child(0);
+                if (collectWholeVariantOutputEnabled) {
+                    collectWholeVariantOutput(innerSlot);
+                }
                 Collection<CollectAccessPathResult> outerSlotAccessPaths = 
allSlotToAccessPaths.get(
                         output.getExprId().asInt());

Review Comment:
   This fallback still loses the full-output requirement when the top project 
returns a VARIANT-valued expression rather than a bare slot. For example, 
`SELECT if(flag, v1, v2) AS a FROM variant_tbl WHERE v1['p'] IS NOT NULL` 
reaches this branch for the alias expression with an empty collector context. 
The default expression visitor then visits `v1`/`v2` with fresh empty contexts, 
so no root `[v1]` or `[v2]` demand is recorded. The filter can leave only `[v1, 
p]` at the scan, but when `flag` selects `v1` the projected `a` needs the whole 
VARIANT value and can be returned with only the pruned subpath. Please collect 
whole-root access for VARIANT slots under projected VARIANT expressions, and 
add coverage for a whole VARIANT expression output plus a sibling nested 
predicate. This is distinct from the existing alias-of-slot and 
dynamic-subscript threads because the missed root demand is introduced by 
returning a non-slot VARIANT expression itself.



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