File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
datafusion/functions/src/math Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -107,20 +107,17 @@ impl ScalarUDFImpl for NanvlFunc {
107107 . cast_to ( args. return_type ( ) , None ) ;
108108 }
109109
110- let target_type = if args
111- . args
112- . iter ( )
113- . all ( |arg| matches ! ( arg. data_type( ) , Float32 ) )
114- {
115- Float32
116- } else {
117- Float64
118- } ;
110+ let target_type = args. return_type ( ) ;
111+ if !matches ! ( target_type, Float32 | Float64 ) {
112+ return exec_err ! (
113+ "Unsupported return type {target_type:?} for function nanvl"
114+ ) ;
115+ }
119116
120117 let casted_args = args
121118 . args
122119 . iter ( )
123- . map ( |arg| arg. cast_to ( & target_type, None ) )
120+ . map ( |arg| arg. cast_to ( target_type, None ) )
124121 . collect :: < Result < Vec < _ > > > ( ) ?;
125122
126123 make_scalar_function ( nanvl, vec ! [ ] ) ( & casted_args)
You can’t perform that action at this time.
0 commit comments