File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,15 +48,8 @@ impl ScalarUDFImpl for JsonFromScalar {
4848 }
4949
5050 fn return_type ( & self , arg_types : & [ DataType ] ) -> DataFusionResult < DataType > {
51- if arg_types. len ( ) != 1 {
52- return plan_err ! (
53- "The '{}' function requires exactly one argument, got {}" ,
54- self . name( ) ,
55- arg_types. len( )
56- ) ;
57- }
5851 // Check that the input type is a scalar type that we can convert to JSON
59- match arg_types[ 0 ] {
52+ match arg_types[ 0 ] { // The signature check ensures we only get one argument
6053 DataType :: Null
6154 | DataType :: Boolean
6255 | DataType :: Int8
@@ -80,14 +73,7 @@ impl ScalarUDFImpl for JsonFromScalar {
8073 }
8174
8275 fn invoke_with_args ( & self , mut args : ScalarFunctionArgs ) -> DataFusionResult < ColumnarValue > {
83- if args. args . len ( ) != 1 {
84- return exec_err ! (
85- "The '{}' function requires exactly one argument, got {}" ,
86- self . name( ) ,
87- args. args. len( )
88- ) ;
89- }
90-
76+ // The signature check ensures we only get one argument
9177 match args. args . pop ( ) . expect ( "Expected exactly one argument" ) {
9278 ColumnarValue :: Scalar ( scalar) => {
9379 let field = scalar_to_json_union_field ( scalar) ?;
You can’t perform that action at this time.
0 commit comments