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


##########
datafusion/expr/src/higher_order_function.rs:
##########
@@ -261,22 +274,27 @@ impl LambdaArgument {
         params: Vec<FieldRef>,
         body: Arc<dyn PhysicalExpr>,
         captures: Option<RecordBatch>,
+        used_param_indices: &[usize],
     ) -> Self {
-        let fields = match &captures {
+        let used_param_indices = used_param_indices.to_vec();
+        let effective_params = used_param_indices.iter().map(|i| 
Arc::clone(&params[*i]));

Review Comment:
   There is a potential for a panic here if `used_param_indices` ever contains 
an index that is larger than the length of `params`. In practice, not a problem 
but it looks like this is a `pub` function so we at least need to document the 
invariant. Maybe even a `debug_assert`.



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