@@ -28,7 +28,7 @@ use crate::expr_fn::binary_expr;
2828use crate :: function:: WindowFunctionSimplification ;
2929use crate :: logical_plan:: Subquery ;
3030use crate :: Volatility ;
31- use crate :: { udaf , ExprSchemable , Operator , Signature , WindowFrame , WindowUDF } ;
31+ use crate :: { ExprSchemable , Operator , Signature , WindowFrame , WindowUDF } ;
3232
3333use arrow:: datatypes:: { DataType , Field , FieldRef } ;
3434use datafusion_common:: cse:: { HashNode , NormalizeEq , Normalizeable } ;
@@ -994,7 +994,7 @@ pub struct AggregateFunctionParams {
994994 /// Optional filter
995995 pub filter : Option < Box < Expr > > ,
996996 /// Optional ordering
997- pub order_by : Option < Vec < Sort > > ,
997+ pub order_by : Vec < Sort > ,
998998 pub null_treatment : Option < NullTreatment > ,
999999}
10001000
@@ -1005,7 +1005,7 @@ impl AggregateFunction {
10051005 args : Vec < Expr > ,
10061006 distinct : bool ,
10071007 filter : Option < Box < Expr > > ,
1008- order_by : Option < Vec < Sort > > ,
1008+ order_by : Vec < Sort > ,
10091009 null_treatment : Option < NullTreatment > ,
10101010 ) -> Self {
10111011 Self {
@@ -1175,26 +1175,26 @@ impl Exists {
11751175
11761176/// User Defined Aggregate Function
11771177///
1178- /// See [`udaf::AggregateUDF`] for more information.
1178+ /// See [`crate:: udaf::AggregateUDF`] for more information.
11791179#[ derive( Clone , PartialEq , Eq , Hash , Debug ) ]
11801180pub struct AggregateUDF {
11811181 /// The function
1182- pub fun : Arc < udaf :: AggregateUDF > ,
1182+ pub fun : Arc < crate :: AggregateUDF > ,
11831183 /// List of expressions to feed to the functions as arguments
11841184 pub args : Vec < Expr > ,
11851185 /// Optional filter
11861186 pub filter : Option < Box < Expr > > ,
11871187 /// Optional ORDER BY applied prior to aggregating
1188- pub order_by : Option < Vec < Expr > > ,
1188+ pub order_by : Vec < Expr > ,
11891189}
11901190
11911191impl AggregateUDF {
11921192 /// Create a new AggregateUDF expression
11931193 pub fn new (
1194- fun : Arc < udaf :: AggregateUDF > ,
1194+ fun : Arc < crate :: AggregateUDF > ,
11951195 args : Vec < Expr > ,
11961196 filter : Option < Box < Expr > > ,
1197- order_by : Option < Vec < Expr > > ,
1197+ order_by : Vec < Expr > ,
11981198 ) -> Self {
11991199 Self {
12001200 fun,
@@ -2303,18 +2303,15 @@ impl NormalizeEq for Expr {
23032303 ( None , None ) => true ,
23042304 _ => false ,
23052305 }
2306- && match ( self_order_by, other_order_by) {
2307- ( Some ( self_order_by) , Some ( other_order_by) ) => self_order_by
2308- . iter ( )
2309- . zip ( other_order_by. iter ( ) )
2310- . all ( |( a, b) | {
2311- a. asc == b. asc
2312- && a. nulls_first == b. nulls_first
2313- && a. expr . normalize_eq ( & b. expr )
2314- } ) ,
2315- ( None , None ) => true ,
2316- _ => false ,
2317- }
2306+ && self_order_by
2307+ . iter ( )
2308+ . zip ( other_order_by. iter ( ) )
2309+ . all ( |( a, b) | {
2310+ a. asc == b. asc
2311+ && a. nulls_first == b. nulls_first
2312+ && a. expr . normalize_eq ( & b. expr )
2313+ } )
2314+ && self_order_by. len ( ) == other_order_by. len ( )
23182315 }
23192316 ( Expr :: WindowFunction ( left) , Expr :: WindowFunction ( other) ) => {
23202317 let WindowFunction {
0 commit comments