16
16
// under the License.
17
17
18
18
use datafusion:: functions_aggregate:: all_default_aggregate_functions;
19
- use datafusion_expr:: AggregateExt ;
19
+ use datafusion_expr:: ExprFunctionExt as AggregateExt ;
20
20
use pyo3:: { prelude:: * , wrap_pyfunction} ;
21
21
22
22
use crate :: common:: data_type:: NullTreatment ;
@@ -31,9 +31,7 @@ use datafusion::functions_aggregate;
31
31
use datafusion_common:: { Column , ScalarValue , TableReference } ;
32
32
use datafusion_expr:: expr:: Alias ;
33
33
use datafusion_expr:: {
34
- expr:: {
35
- find_df_window_func, AggregateFunction , AggregateFunctionDefinition , Sort , WindowFunction ,
36
- } ,
34
+ expr:: { find_df_window_func, AggregateFunction , Sort , WindowFunction } ,
37
35
lit, Expr , WindowFunctionDefinition ,
38
36
} ;
39
37
@@ -638,18 +636,16 @@ fn window(
638
636
}
639
637
640
638
macro_rules! aggregate_function {
641
- ( $NAME: ident, $FUNC: ident ) => {
639
+ ( $NAME: ident, $FUNC: path ) => {
642
640
aggregate_function!( $NAME, $FUNC, stringify!( $NAME) ) ;
643
641
} ;
644
- ( $NAME: ident, $FUNC: ident , $DOC: expr) => {
642
+ ( $NAME: ident, $FUNC: path , $DOC: expr) => {
645
643
#[ doc = $DOC]
646
644
#[ pyfunction]
647
645
#[ pyo3( signature = ( * args, distinct=false ) ) ]
648
646
fn $NAME( args: Vec <PyExpr >, distinct: bool ) -> PyExpr {
649
647
let expr = datafusion_expr:: Expr :: AggregateFunction ( AggregateFunction {
650
- func_def: AggregateFunctionDefinition :: BuiltIn (
651
- datafusion_expr:: aggregate_function:: AggregateFunction :: $FUNC,
652
- ) ,
648
+ func: $FUNC( ) ,
653
649
args: args. into_iter( ) . map( |e| e. into( ) ) . collect( ) ,
654
650
distinct,
655
651
filter: None ,
@@ -884,9 +880,9 @@ array_fn!(array_resize, array size value);
884
880
array_fn ! ( flatten, array) ;
885
881
array_fn ! ( range, start stop step) ;
886
882
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 ) ;
890
886
891
887
pub ( crate ) fn init_module ( m : & Bound < ' _ , PyModule > ) -> PyResult < ( ) > {
892
888
m. add_wrapped ( wrap_pyfunction ! ( abs) ) ?;
0 commit comments