Jefffrey commented on code in PR #19065:
URL: https://github.com/apache/datafusion/pull/19065#discussion_r2585343119


##########
datafusion/spark/src/function/math/width_bucket.rs:
##########
@@ -77,7 +123,16 @@ impl ScalarUDFImpl for SparkWidthBucket {
     }
 
     fn invoke_with_args(&self, args: ScalarFunctionArgs) -> 
Result<ColumnarValue> {
-        make_scalar_function(width_bucket_kern, vec![])(&args.args)
+        let [value, minv, maxv, buckets] = take_function_args(self.name(), 
&args.args)?;
+
+        let arrays = vec![
+            value.to_array(args.number_rows)?,
+            minv.to_array(args.number_rows)?,
+            maxv.to_array(args.number_rows)?,
+            buckets.to_array(args.number_rows)?,
+        ];
+
+        width_bucket_kern(&arrays).map(ColumnarValue::Array)

Review Comment:
   The signature should now guard that for us; `take_function_args` would only 
be used as an ergonomic way of extracting the args required. The fact that it 
errors if the arg count is wrong would just be an extra layer of defense but 
not the main defense, as only if something went wrong with the signature 
related code could that error path ever occur.



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