jonahgao commented on code in PR #12922:
URL: https://github.com/apache/datafusion/pull/12922#discussion_r1802220611
##########
datafusion/functions/src/macros.rs:
##########
@@ -226,9 +226,8 @@ macro_rules! make_math_unary_udf {
$EVALUATE_BOUNDS(inputs)
}
- fn invoke(&self, args: &[ColumnarValue]) ->
Result<ColumnarValue> {
- let args = ColumnarValue::values_to_arrays(args)?;
-
+ fn invoke(&self, col_args: &[ColumnarValue]) ->
Result<ColumnarValue> {
Review Comment:
> Ideally, `invoke` should also get the number of expected rows and then
there would also be no need for a special `invoke_no_args`.
Make sense to me. This makes it easy to support `rand_int`. It seems that
currently all functions should return a scalar value when all their arguments
are scalar, for example, math functions that do not use `make_math_*_udf`.
> Maybe we can just assume that if the result of any immutable function is
an array of size one, we might as well convert it to a scalar value.
This can be a general solution. The disadvantage is that if the arguments
are not real scalar, it will cause unnecessary overhead, as the final result of
queries will still need to be converted back into arrays.
--
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]