gstvg commented on PR #22853:
URL: https://github.com/apache/datafusion/pull/22853#issuecomment-4675481540

   I imagined another approach:
   
   - Add `used_params` as `HashSet<String>` or `Option<HashSet<String>>` to 
`LambdaArgument`
   - Add `LambdaArgument::new_with_used_params`, the existing `new` invokes 
this new method with `None` or the hash set of all params names
   - While traversing the lambda body to collect used indices, also collect 
used lambda variables names of the given lambda (ignoring vars of others 
lambda), and provide them to `LambdaArgument::new_with_params`. It must take 
into account shadowing: `(k, v) -> func(column, (k, v2) -> k + v2 + v)`, the 
innermost lambda param `k` should not flag the outermost one as used. Only the 
outermost `v` is used
   - In `LambdaArgument::evaluate`, just evaluates and push to the batch the 
parameters that are actually used, so unused ones don't shift the others.
   
   Because this skips the evaluation of declared but not used parameters, I 
personally prefer this one, WDYT?


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