@@ -23,9 +23,12 @@ use arrow::datatypes::DataType;
2323use datafusion_expr:: simplify:: { ExprSimplifyResult , SimplifyInfo } ;
2424
2525use crate :: utils:: make_scalar_function;
26+ use datafusion_common:: types:: logical_string;
2627use datafusion_common:: { internal_err, Result , ScalarValue } ;
27- use datafusion_expr:: { ColumnarValue , Documentation , Expr , Like } ;
28- use datafusion_expr:: { ScalarFunctionArgs , ScalarUDFImpl , Signature , Volatility } ;
28+ use datafusion_expr:: {
29+ Coercion , ColumnarValue , Documentation , Expr , Like , ScalarFunctionArgs ,
30+ ScalarUDFImpl , Signature , TypeSignatureClass , Volatility ,
31+ } ;
2932use datafusion_macros:: user_doc;
3033
3134/// Returns true if string starts with prefix.
@@ -64,7 +67,13 @@ impl Default for StartsWithFunc {
6467impl StartsWithFunc {
6568 pub fn new ( ) -> Self {
6669 Self {
67- signature : Signature :: string ( 2 , Volatility :: Immutable ) ,
70+ signature : Signature :: coercible (
71+ vec ! [
72+ Coercion :: new_exact( TypeSignatureClass :: Native ( logical_string( ) ) ) ,
73+ Coercion :: new_exact( TypeSignatureClass :: Native ( logical_string( ) ) ) ,
74+ ] ,
75+ Volatility :: Immutable ,
76+ ) ,
6877 }
6978 }
7079}
0 commit comments