@@ -26,7 +26,9 @@ use std::vec;
2626
2727use arrow:: datatypes:: { DataType , Field , FieldRef } ;
2828
29- use datafusion_common:: { Result , ScalarValue , Statistics , exec_err, not_impl_err} ;
29+ use datafusion_common:: {
30+ DataFusionError , Result , ScalarValue , Statistics , exec_err, not_impl_err,
31+ } ;
3032use datafusion_expr_common:: dyn_eq:: { DynEq , DynHash } ;
3133use datafusion_expr_common:: operator:: Operator ;
3234use datafusion_physical_expr_common:: physical_expr:: PhysicalExpr ;
@@ -517,6 +519,15 @@ pub trait AggregateUDFImpl: Debug + DynEq + DynHash + Send + Sync {
517519 /// types are accepted and the function's Volatility.
518520 fn signature ( & self ) -> & Signature ;
519521
522+ /// Allows a function to provide a more actionable signature failure
523+ /// message than the generic `OneOf` fallback.
524+ fn diagnose_failed_signature (
525+ & self ,
526+ _arg_types : & [ DataType ] ,
527+ ) -> Option < DataFusionError > {
528+ None
529+ }
530+
520531 /// What [`DataType`] will be returned by this function, given the types of
521532 /// the arguments
522533 fn return_type ( & self , arg_types : & [ DataType ] ) -> Result < DataType > ;
@@ -1243,6 +1254,13 @@ impl AggregateUDFImpl for AliasedAggregateUDFImpl {
12431254 self . inner . signature ( )
12441255 }
12451256
1257+ fn diagnose_failed_signature (
1258+ & self ,
1259+ arg_types : & [ DataType ] ,
1260+ ) -> Option < DataFusionError > {
1261+ self . inner . diagnose_failed_signature ( arg_types)
1262+ }
1263+
12461264 fn return_type ( & self , arg_types : & [ DataType ] ) -> Result < DataType > {
12471265 self . inner . return_type ( arg_types)
12481266 }
0 commit comments