File tree 2 files changed +24
-0
lines changed
physical-expr-common/src/aggregate
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -249,6 +249,14 @@ impl AggregateUDF {
249
249
pub fn simplify ( & self ) -> Option < AggregateFunctionSimplification > {
250
250
self . inner . simplify ( )
251
251
}
252
+
253
+ /// Returns true if the function is max, false if the function is min
254
+ /// None in all other cases, used in certain optimizations or
255
+ /// or aggregate
256
+ ///
257
+ pub fn is_descending ( & self ) -> Option < bool > {
258
+ self . inner . is_descending ( )
259
+ }
252
260
}
253
261
254
262
impl < F > From < F > for AggregateUDF
@@ -536,6 +544,16 @@ pub trait AggregateUDFImpl: Debug + Send + Sync {
536
544
self . signature ( ) . hash ( hasher) ;
537
545
hasher. finish ( )
538
546
}
547
+
548
+ /// If this function is max, return true
549
+ /// if the function is min, return false
550
+ /// otherwise return None (the default)
551
+ ///
552
+ ///
553
+ /// Note: this is used to use special aggregate implementations in certain conditions
554
+ fn is_descending ( & self ) -> Option < bool > {
555
+ None
556
+ }
539
557
}
540
558
541
559
pub enum ReversedUDAF {
Original file line number Diff line number Diff line change @@ -730,6 +730,12 @@ impl AggregateExpr for AggregateFunctionExpr {
730
730
}
731
731
}
732
732
}
733
+
734
+ fn get_minmax_desc ( & self ) -> Option < ( Field , bool ) > {
735
+ self . fun
736
+ . is_descending ( )
737
+ . and_then ( |flag| self . field ( ) . ok ( ) . map ( |f| ( f, flag) ) )
738
+ }
733
739
}
734
740
735
741
impl PartialEq < dyn Any > for AggregateFunctionExpr {
You can’t perform that action at this time.
0 commit comments