@@ -24,6 +24,7 @@ use super::power::PowerFunc;
2424
2525use arrow:: array:: { ArrayRef , AsArray } ;
2626use arrow:: datatypes:: { DataType , Float32Type , Float64Type } ;
27+ use datafusion_common:: types:: NativeType ;
2728use datafusion_common:: {
2829 exec_err, internal_err, plan_datafusion_err, plan_err, Result , ScalarValue ,
2930} ;
@@ -32,9 +33,10 @@ use datafusion_expr::simplify::{ExprSimplifyResult, SimplifyInfo};
3233use datafusion_expr:: sort_properties:: { ExprProperties , SortProperties } ;
3334use datafusion_expr:: {
3435 lit, ColumnarValue , Documentation , Expr , ScalarFunctionArgs , ScalarUDF ,
35- TypeSignature :: * ,
36+ TypeSignature , TypeSignatureClass ,
3637} ;
3738use datafusion_expr:: { ScalarUDFImpl , Signature , Volatility } ;
39+ use datafusion_expr_common:: signature:: Coercion ;
3840use datafusion_macros:: user_doc;
3941
4042#[ user_doc(
@@ -58,14 +60,26 @@ impl Default for LogFunc {
5860
5961impl LogFunc {
6062 pub fn new ( ) -> Self {
61- use DataType :: * ;
6263 Self {
6364 signature : Signature :: one_of (
6465 vec ! [
65- Exact ( vec![ Float32 ] ) ,
66- Exact ( vec![ Float64 ] ) ,
67- Exact ( vec![ Float32 , Float32 ] ) ,
68- Exact ( vec![ Float64 , Float64 ] ) ,
66+ TypeSignature :: Coercible ( vec![ Coercion :: new_implicit(
67+ TypeSignatureClass :: Float ,
68+ vec![ TypeSignatureClass :: Integer ] ,
69+ NativeType :: Float64 ,
70+ ) ] ) ,
71+ TypeSignature :: Coercible ( vec![
72+ Coercion :: new_implicit(
73+ TypeSignatureClass :: Float ,
74+ vec![ TypeSignatureClass :: Integer ] ,
75+ NativeType :: Float32 ,
76+ ) ,
77+ Coercion :: new_implicit(
78+ TypeSignatureClass :: Float ,
79+ vec![ TypeSignatureClass :: Integer ] ,
80+ NativeType :: Float64 ,
81+ ) ,
82+ ] ) ,
6983 ] ,
7084 Volatility :: Immutable ,
7185 ) ,
0 commit comments