@@ -74,8 +74,8 @@ use datafusion_common::{
74
74
} ;
75
75
use datafusion_expr:: dml:: CopyTo ;
76
76
use datafusion_expr:: expr:: {
77
- self , AggregateFunction , AggregateFunctionDefinition , Alias , Between , BinaryExpr ,
78
- Cast , GroupingSet , InList , Like , TryCast , WindowFunction ,
77
+ self , AggregateFunction , Alias , Between , BinaryExpr , Cast , GroupingSet , InList , Like ,
78
+ TryCast , WindowFunction ,
79
79
} ;
80
80
use datafusion_expr:: expr_rewriter:: unnormalize_cols;
81
81
use datafusion_expr:: expr_vec_fmt;
@@ -223,18 +223,15 @@ fn create_physical_name(e: &Expr, is_first_expr: bool) -> Result<String> {
223
223
create_function_physical_name ( & fun. to_string ( ) , false , args, Some ( order_by) )
224
224
}
225
225
Expr :: AggregateFunction ( AggregateFunction {
226
- func_def ,
226
+ func ,
227
227
distinct,
228
228
args,
229
229
filter : _,
230
230
order_by,
231
231
null_treatment : _,
232
- } ) => create_function_physical_name (
233
- func_def. name ( ) ,
234
- * distinct,
235
- args,
236
- order_by. as_ref ( ) ,
237
- ) ,
232
+ } ) => {
233
+ create_function_physical_name ( func. name ( ) , * distinct, args, order_by. as_ref ( ) )
234
+ }
238
235
Expr :: GroupingSet ( grouping_set) => match grouping_set {
239
236
GroupingSet :: Rollup ( exprs) => Ok ( format ! (
240
237
"ROLLUP ({})" ,
@@ -1817,7 +1814,7 @@ pub fn create_aggregate_expr_with_name_and_maybe_filter(
1817
1814
) -> Result < AggregateExprWithOptionalArgs > {
1818
1815
match e {
1819
1816
Expr :: AggregateFunction ( AggregateFunction {
1820
- func_def ,
1817
+ func ,
1821
1818
distinct,
1822
1819
args,
1823
1820
filter,
@@ -1839,36 +1836,34 @@ pub fn create_aggregate_expr_with_name_and_maybe_filter(
1839
1836
. unwrap_or ( sqlparser:: ast:: NullTreatment :: RespectNulls )
1840
1837
== NullTreatment :: IgnoreNulls ;
1841
1838
1842
- let ( agg_expr, filter, order_by) = match func_def {
1843
- AggregateFunctionDefinition :: UDF ( fun) => {
1844
- let sort_exprs = order_by. clone ( ) . unwrap_or ( vec ! [ ] ) ;
1845
- let physical_sort_exprs = match order_by {
1846
- Some ( exprs) => Some ( create_physical_sort_exprs (
1847
- exprs,
1848
- logical_input_schema,
1849
- execution_props,
1850
- ) ?) ,
1851
- None => None ,
1852
- } ;
1839
+ let ( agg_expr, filter, order_by) = {
1840
+ let sort_exprs = order_by. clone ( ) . unwrap_or ( vec ! [ ] ) ;
1841
+ let physical_sort_exprs = match order_by {
1842
+ Some ( exprs) => Some ( create_physical_sort_exprs (
1843
+ exprs,
1844
+ logical_input_schema,
1845
+ execution_props,
1846
+ ) ?) ,
1847
+ None => None ,
1848
+ } ;
1853
1849
1854
- let ordering_reqs: Vec < PhysicalSortExpr > =
1855
- physical_sort_exprs. clone ( ) . unwrap_or ( vec ! [ ] ) ;
1850
+ let ordering_reqs: Vec < PhysicalSortExpr > =
1851
+ physical_sort_exprs. clone ( ) . unwrap_or ( vec ! [ ] ) ;
1856
1852
1857
- let agg_expr = udaf:: create_aggregate_expr_with_dfschema (
1858
- fun ,
1859
- & physical_args,
1860
- args,
1861
- & sort_exprs,
1862
- & ordering_reqs,
1863
- logical_input_schema,
1864
- name,
1865
- ignore_nulls,
1866
- * distinct,
1867
- false ,
1868
- ) ?;
1853
+ let agg_expr = udaf:: create_aggregate_expr_with_dfschema (
1854
+ func ,
1855
+ & physical_args,
1856
+ args,
1857
+ & sort_exprs,
1858
+ & ordering_reqs,
1859
+ logical_input_schema,
1860
+ name,
1861
+ ignore_nulls,
1862
+ * distinct,
1863
+ false ,
1864
+ ) ?;
1869
1865
1870
- ( agg_expr, filter, physical_sort_exprs)
1871
- }
1866
+ ( agg_expr, filter, physical_sort_exprs)
1872
1867
} ;
1873
1868
1874
1869
Ok ( ( agg_expr, filter, order_by) )
0 commit comments