Is your feature request related to a problem or challenge?
When writing a new UDF, a developer needs to decide how to perform error management in functions that return Result, such as return_type and invoke. Looking at the existing codebase it is not obvious what are the error management best practices
Errors in return type
-
Regexp like uses an plan_err data types of args do not match the expected types
|
fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> { |
. Is this check redundant?
-
Except expects two arguments but doesn't check the length, just the type
|
impl ScalarUDFImpl for ArrayExcept { |
.
Errors in invoke
In the resize function, there is a check on argument lengths in invoke which is not present in the return_type function
|
use datafusion_common::{exec_err, internal_datafusion_err, Result, ScalarValue}; |
The same function also returns exec_err, and internal_datafusion_err
Describe the solution you'd like
As a developers of custom UDF I would like to know:
- what errors I need to check for and what are already checked by the planner (number of arguments?)
- what type of errors need to be raised in which conditions
Describe alternatives you've considered
No response
Additional context
No response
Is your feature request related to a problem or challenge?
When writing a new UDF, a developer needs to decide how to perform error management in functions that return
Result, such asreturn_typeandinvoke. Looking at the existing codebase it is not obvious what are the error management best practicesErrors in return type
Regexp like uses an
plan_errdata types of args do not match the expected typesdatafusion/datafusion/functions/src/regex/regexplike.rs
Line 74 in 77311a5
Except expects two arguments but doesn't check the length, just the type
datafusion/datafusion/functions-array/src/except.rs
Line 55 in 77311a5
Errors in invoke
In the resize function, there is a check on argument lengths in invoke which is not present in the
return_typefunctiondatafusion/datafusion/functions-array/src/resize.rs
Line 27 in 77311a5
The same function also returns
exec_err, andinternal_datafusion_errDescribe the solution you'd like
As a developers of custom UDF I would like to know:
Describe alternatives you've considered
No response
Additional context
No response