@@ -22,7 +22,7 @@ use crate::aggregate_fn::AggregateFnId;
2222use crate :: aggregate_fn:: AggregateFnRef ;
2323use crate :: aggregate_fn:: AggregateFnSatisfaction ;
2424use crate :: aggregate_fn:: AggregateFnVTable ;
25- use crate :: aggregate_fn:: EmptyOptions ;
25+ use crate :: aggregate_fn:: NumericalAggregateOpts ;
2626use crate :: aggregate_fn:: fns:: max:: Max ;
2727use crate :: aggregate_fn:: fns:: min_max:: MinMax ;
2828use crate :: aggregate_fn:: fns:: min_max:: min_max;
@@ -172,7 +172,11 @@ impl AggregateFnVTable for BoundedMax {
172172 } ;
173173 }
174174
175- if requested. is :: < Max > ( ) {
175+ // The stored bound skips NaNs, so it cannot stand in for a NaN-including maximum.
176+ if requested
177+ . as_opt :: < Max > ( )
178+ . is_some_and ( |options| options. skip_nans )
179+ {
176180 AggregateFnSatisfaction :: Approximate
177181 } else {
178182 AggregateFnSatisfaction :: No
@@ -263,7 +267,7 @@ impl AggregateFnVTable for BoundedMax {
263267 Columnar :: Canonical ( canonical) => canonical. clone ( ) . into_array ( ) ,
264268 Columnar :: Constant ( constant) => constant. clone ( ) . into_array ( ) ,
265269 } ;
266- let Some ( result) = min_max ( & array, ctx) ? else {
270+ let Some ( result) = min_max ( & array, ctx, NumericalAggregateOpts :: default ( ) ) ? else {
267271 return Ok ( ( ) ) ;
268272 } ;
269273 match truncate_max ( result. max , partial. max_bytes . get ( ) ) ? {
@@ -284,7 +288,7 @@ impl AggregateFnVTable for BoundedMax {
284288
285289fn supported_dtype < ' a > ( _options : & BoundedMaxOptions , input_dtype : & ' a DType ) -> Option < & ' a DType > {
286290 MinMax
287- . return_dtype ( & EmptyOptions , input_dtype)
291+ . return_dtype ( & NumericalAggregateOpts :: default ( ) , input_dtype)
288292 . map ( |_| input_dtype)
289293}
290294
@@ -324,7 +328,7 @@ mod tests {
324328 use crate :: aggregate_fn:: AggregateFnVTable ;
325329 use crate :: aggregate_fn:: AggregateFnVTableExt ;
326330 use crate :: aggregate_fn:: DynAccumulator ;
327- use crate :: aggregate_fn:: EmptyOptions ;
331+ use crate :: aggregate_fn:: NumericalAggregateOpts ;
328332 use crate :: aggregate_fn:: fns:: bounded_max:: BoundedMax ;
329333 use crate :: aggregate_fn:: fns:: bounded_max:: BoundedMaxOptions ;
330334 use crate :: aggregate_fn:: fns:: bounded_max:: make_bounded_max_partial_dtype;
@@ -519,15 +523,25 @@ mod tests {
519523 AggregateFnSatisfaction :: No
520524 ) ;
521525 assert_eq ! (
522- stored. can_satisfy( & Max . bind( EmptyOptions ) ) ,
526+ stored. can_satisfy( & Max . bind( NumericalAggregateOpts :: default ( ) ) ) ,
523527 AggregateFnSatisfaction :: Approximate
524528 ) ;
525529 assert_eq ! (
526- Max . bind( EmptyOptions ) . can_satisfy( & stored) ,
530+ stored. can_satisfy( & Max . bind( NumericalAggregateOpts :: include_nans( ) ) ) ,
531+ AggregateFnSatisfaction :: No
532+ ) ;
533+ assert_eq ! (
534+ Max . bind( NumericalAggregateOpts :: include_nans( ) )
535+ . can_satisfy( & stored) ,
536+ AggregateFnSatisfaction :: No
537+ ) ;
538+ assert_eq ! (
539+ Max . bind( NumericalAggregateOpts :: default ( ) )
540+ . can_satisfy( & stored) ,
527541 AggregateFnSatisfaction :: Approximate
528542 ) ;
529543 assert_eq ! (
530- stored. can_satisfy( & Min . bind( EmptyOptions ) ) ,
544+ stored. can_satisfy( & Min . bind( NumericalAggregateOpts :: default ( ) ) ) ,
531545 AggregateFnSatisfaction :: No
532546 ) ;
533547 }
0 commit comments