@@ -97,7 +97,7 @@ impl ZstdBuffers {
9797 ArrayParts :: new ( ZstdBuffers , array. dtype ( ) . clone ( ) , array. len ( ) , data)
9898 . with_slots ( slots) ,
9999 ) ?;
100- compressed. statistics ( ) . inherit_from ( array. statistics ( ) ) ;
100+ compressed. aggregations ( ) . inherit_from ( array. aggregations ( ) ) ;
101101 Ok ( compressed)
102102 }
103103
@@ -558,13 +558,16 @@ mod tests {
558558 use vortex_array:: ArrayRef ;
559559 use vortex_array:: IntoArray ;
560560 use vortex_array:: VortexSessionExecute ;
561+ use vortex_array:: aggregate_fn:: AggregateFnVTableExt ;
562+ use vortex_array:: aggregate_fn:: EmptyOptions ;
563+ use vortex_array:: aggregate_fn:: NumericalAggregateOpts ;
564+ use vortex_array:: aggregate_fn:: fns:: count:: Count ;
565+ use vortex_array:: aggregate_fn:: fns:: uncompressed_size_in_bytes:: UncompressedSizeInBytes ;
561566 use vortex_array:: array_session;
562567 use vortex_array:: arrays:: PrimitiveArray ;
563568 use vortex_array:: arrays:: VarBinViewArray ;
564569 use vortex_array:: assert_arrays_eq;
565570 use vortex_array:: expr:: stats:: Precision ;
566- use vortex_array:: expr:: stats:: Stat ;
567- use vortex_array:: expr:: stats:: StatsProvider ;
568571 use vortex_array:: serde:: SerializeOptions ;
569572 use vortex_array:: serde:: SerializedArray ;
570573 use vortex_array:: session:: ArraySessionExt ;
@@ -659,13 +662,30 @@ mod tests {
659662 }
660663
661664 #[ test]
662- fn test_compress_inherits_stats ( ) -> VortexResult < ( ) > {
663- let input = make_primitive_array ( ) ;
664- input. statistics ( ) . set ( Stat :: Min , Precision :: exact ( 0i32 ) ) ;
665-
666- let compressed = ZstdBuffers :: compress ( & input, 3 , & array_session ( ) ) ?;
665+ fn compress_preserves_option_results_and_discards_physical_size ( ) -> VortexResult < ( ) > {
666+ let input = PrimitiveArray :: from_iter ( [ 1.0f64 , f64:: NAN , 3.0 ] ) . into_array ( ) ;
667+ let session = array_session ( ) ;
668+ let mut ctx = session. create_execution_ctx ( ) ;
669+ let skip = Count . bind ( NumericalAggregateOpts :: skip_nans ( ) ) ;
670+ let include = Count . bind ( NumericalAggregateOpts :: include_nans ( ) ) ;
671+ let size = UncompressedSizeInBytes . bind ( EmptyOptions ) ;
672+ for aggregate in [ & skip, & include, & size] {
673+ input. aggregations ( ) . compute_result ( aggregate, & mut ctx) ?;
674+ }
667675
668- assert ! ( !compressed. statistics( ) . get( Stat :: Min ) . is_absent( ) ) ;
676+ let compressed = ZstdBuffers :: compress ( & input, 3 , & session) ?;
677+ assert_eq ! (
678+ compressed. aggregations( ) . get_result_as:: <u64 >( & skip) ?,
679+ Precision :: Exact ( 2 )
680+ ) ;
681+ assert_eq ! (
682+ compressed. aggregations( ) . get_result_as:: <u64 >( & include) ?,
683+ Precision :: Exact ( 3 )
684+ ) ;
685+ assert_eq ! (
686+ compressed. aggregations( ) . get_result( & size) ,
687+ Precision :: Absent
688+ ) ;
669689 Ok ( ( ) )
670690 }
671691
0 commit comments