brucearctor commented on code in PR #69938:
URL: https://github.com/apache/doris/pull/69938#discussion_r4489216517


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownProject.java:
##########
@@ -23,11 +23,15 @@
 import org.apache.doris.nereids.rules.Rule;
 import org.apache.doris.nereids.rules.RuleType;
 import org.apache.doris.nereids.trees.expressions.Alias;
+import org.apache.doris.nereids.trees.expressions.ArrayItemReference;

Review Comment:
   Addressed in 52ff8ea8033a8686cafc13cc6ae636d56cb7de41:
   
   - Added `collectExpressionsWithFreeLambdaArgument(Expression)` / 
`collectFreeLambdaArgumentExpressions(...)` to precompute the identity set of 
sub-expressions with free `ArrayItemSlot` references in a single 
$O(|\text{root}|)$ traversal (tracking lexical binding scope depths per 
`ExprId` and restoring shadowed bindings in reverse order), so 
`rewriteDownShortCircuit` checks `!expressionsWithFreeLambdaArgs.contains(e)` 
in $O(1)$ without rescanning suffixes.
   - Expanded `PushDownProjectTest` to cover the nested `F_i = array_map(x_i -> 
x_i, F_(i+1))` / `ArrayConcat` cross-child chain, multi-argument `Lambda` 
expressions, and `LogicalUnion` with both regular children and 
`constantExprsList`.



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