LiaCastaneda commented on code in PR #24162:
URL: https://github.com/apache/datafusion/pull/24162#discussion_r3756483013


##########
datafusion/physical-expr/src/expressions/lambda.rs:
##########
@@ -43,6 +43,15 @@ pub struct LambdaExpr {
     body: Arc<dyn PhysicalExpr>,
     projected_body: Arc<dyn PhysicalExpr>,
     projection: Vec<usize>,
+    /// Subset of `params` (by name) that the body actually references,
+    /// computed with nested-lambda shadow tracking. Empty when no parameter

Review Comment:
   when a lambda has nested lambdas like `(k, v) -> func(col, (k, v2) -> k + v2 
+ v)`, the innermost `k` "shadows"/"overrides" the outermost `k` bc even though 
they share a name, the innermost `k` is its own separate parameter, not a 
reference to the outer one. So when collecting which parameters a lambda's body 
references n a nested lambda, we need to take this possible name conflict  into 
account, otherwise we'd wrongly count the outer `k` as used just because the 
name appears in the body of the nested lambda.
   
   Its true its a bit unclear by just reading it in the param description, I 
moved the explanation to `CollectUsedVisitor` that actually handles the logic 
for "shadowed" params



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