1616// under the License.
1717
1818use datafusion:: functions_aggregate:: all_default_aggregate_functions;
19- use datafusion_expr:: AggregateExt ;
19+ use datafusion_expr:: ExprFunctionExt as AggregateExt ;
2020use pyo3:: { prelude:: * , wrap_pyfunction} ;
2121
2222use crate :: common:: data_type:: NullTreatment ;
@@ -31,9 +31,7 @@ use datafusion::functions_aggregate;
3131use datafusion_common:: { Column , ScalarValue , TableReference } ;
3232use datafusion_expr:: expr:: Alias ;
3333use datafusion_expr:: {
34- expr:: {
35- find_df_window_func, AggregateFunction , AggregateFunctionDefinition , Sort , WindowFunction ,
36- } ,
34+ expr:: { find_df_window_func, AggregateFunction , Sort , WindowFunction } ,
3735 lit, Expr , WindowFunctionDefinition ,
3836} ;
3937
@@ -638,18 +636,16 @@ fn window(
638636}
639637
640638macro_rules! aggregate_function {
641- ( $NAME: ident, $FUNC: ident ) => {
639+ ( $NAME: ident, $FUNC: path ) => {
642640 aggregate_function!( $NAME, $FUNC, stringify!( $NAME) ) ;
643641 } ;
644- ( $NAME: ident, $FUNC: ident , $DOC: expr) => {
642+ ( $NAME: ident, $FUNC: path , $DOC: expr) => {
645643 #[ doc = $DOC]
646644 #[ pyfunction]
647645 #[ pyo3( signature = ( * args, distinct=false ) ) ]
648646 fn $NAME( args: Vec <PyExpr >, distinct: bool ) -> PyExpr {
649647 let expr = datafusion_expr:: Expr :: AggregateFunction ( AggregateFunction {
650- func_def: AggregateFunctionDefinition :: BuiltIn (
651- datafusion_expr:: aggregate_function:: AggregateFunction :: $FUNC,
652- ) ,
648+ func: $FUNC( ) ,
653649 args: args. into_iter( ) . map( |e| e. into( ) ) . collect( ) ,
654650 distinct,
655651 filter: None ,
@@ -884,9 +880,9 @@ array_fn!(array_resize, array size value);
884880array_fn ! ( flatten, array) ;
885881array_fn ! ( range, start stop step) ;
886882
887- aggregate_function ! ( array_agg, ArrayAgg ) ;
888- aggregate_function ! ( max, Max ) ;
889- aggregate_function ! ( min, Min ) ;
883+ aggregate_function ! ( array_agg, functions_aggregate :: array_agg :: array_agg_udaf ) ;
884+ aggregate_function ! ( max, functions_aggregate :: min_max :: max_udaf ) ;
885+ aggregate_function ! ( min, functions_aggregate :: min_max :: min_udaf ) ;
890886
891887pub ( crate ) fn init_module ( m : & Bound < ' _ , PyModule > ) -> PyResult < ( ) > {
892888 m. add_wrapped ( wrap_pyfunction ! ( abs) ) ?;
0 commit comments