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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathExpressionCollector.java:
##########
@@ -399,6 +400,26 @@ public Void visitMapValues(MapValues mapValues, 
CollectorContext context) {
         return continueCollectAccessPath(mapValues.getArgument(0), context);
     }
 
+    @Override
+    public Void visitMapEntries(MapEntries mapEntries, CollectorContext 
context) {
+        LinkedList<String> path = context.accessPathBuilder.accessPath;
+        if (path.size() >= 2 && AccessPathInfo.ACCESS_ALL.equals(path.get(0))) 
{

Review Comment:
   [P1] Keep captured map values in nested-Lambda access paths
   
   For a native table with `m MAP<INT,STRUCT<a:INT>>`, consider 
`transform_values((k,v) -> array_map(x -> element_at(v,'a') + x, [0]), m)`. 
This lowers to an outer entry Lambda that directly retains `entry[1]` but reads 
`entry[2]` only inside the inner Lambda. While that inner frame is on top, 
`visitArrayItemSlot` cannot resolve the outer entry, so the value access never 
reaches this conversion; the outer fallback sees the ExprId syntactically 
referenced and adds no full path, leaving only `m.KEYS`.
   
   That is not conservative for native scans: 
`MapFileColumnIterator::set_access_paths()` marks VALUES as `SKIP` for a 
KEYS-only path, and lazy materialization inserts defaults to keep the Map shape 
aligned. The nested Lambda therefore evaluates default/null data instead of the 
stored `v.a`, producing wrong transformed values. Please resolve captured entry 
slots through the active Lambda frames (or request full access conservatively) 
and add a stored-column test with direct key use and value use only inside a 
nested Lambda.



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