File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,13 @@ impl ScalarUDFImpl for SubstrFunc {
84
84
}
85
85
86
86
fn coerce_types ( & self , arg_types : & [ DataType ] ) -> Result < Vec < DataType > > {
87
+ if arg_types. len ( ) < 2 || arg_types. len ( ) > 3 {
88
+ return plan_err ! (
89
+ "The {} function requires 2 or 3 arguments, but got {}." ,
90
+ self . name( ) ,
91
+ arg_types. len( )
92
+ ) ;
93
+ }
87
94
let first_data_type = match & arg_types[ 0 ] {
88
95
DataType :: Null => Ok ( DataType :: Utf8 ) ,
89
96
DataType :: LargeUtf8 | DataType :: Utf8View | DataType :: Utf8 => Ok ( arg_types[ 0 ] . clone ( ) ) ,
Original file line number Diff line number Diff line change @@ -130,3 +130,6 @@ order by c9
130
130
131
131
query error DataFusion error: Arrow error: Cast error: Cannot cast string 'foo' to value of Int64 type
132
132
create table foo as values (1), ('foo');
133
+
134
+ query error No function matches
135
+ select 1 group by substr('');
You can’t perform that action at this time.
0 commit comments