File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
host/tests/integration_tests Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -82,3 +82,30 @@ async fn test_add_one() {
8282 & Int32Array :: from_iter( [ Some ( 4 ) , Some ( 4 ) , Some ( 4 ) ] ) as & dyn Array ,
8383 ) ;
8484}
85+
86+ #[ tokio:: test( flavor = "multi_thread" ) ]
87+ async fn test_invoke_with_args_returns_error ( ) {
88+ let component = WasmComponentPrecompiled :: new ( datafusion_udf_wasm_bundle:: BIN_EXAMPLE . into ( ) )
89+ . await
90+ . unwrap ( ) ;
91+ let mut udfs = WasmScalarUdf :: new (
92+ & component,
93+ & Default :: default ( ) ,
94+ Handle :: current ( ) ,
95+ "" . to_owned ( ) ,
96+ )
97+ . await
98+ . unwrap ( ) ;
99+ let udf = udfs. pop ( ) . unwrap ( ) ;
100+
101+ let result = udf. invoke_with_args ( ScalarFunctionArgs {
102+ args : vec ! [ ColumnarValue :: Scalar ( ScalarValue :: Int32 ( Some ( 3 ) ) ) ] ,
103+ arg_fields : vec ! [ Arc :: new( Field :: new( "a1" , DataType :: Int32 , true ) ) ] ,
104+ number_rows : 3 ,
105+ return_field : Arc :: new ( Field :: new ( "r" , DataType :: Int32 , true ) ) ,
106+ } ) ;
107+
108+ assert ! ( result. is_err( ) ) ;
109+ let error = result. unwrap_err ( ) ;
110+ assert ! ( error. to_string( ) . contains( "synchronous invocation of WasmScalarUdf is not supported, use invoke_async_with_args instead" ) ) ;
111+ }
You can’t perform that action at this time.
0 commit comments