@@ -14,14 +14,18 @@ use crate::array::primitive::PrimitiveArray;
1414use crate :: stats:: { ArrayStatisticsCompute , Stat , StatsSet } ;
1515use crate :: validity:: { ArrayValidity , LogicalValidity } ;
1616use crate :: variants:: PrimitiveArrayTrait ;
17- use crate :: { ArrayDType , IntoArrayVariant } ;
17+ use crate :: { ArrayDType , ArrayTrait as _ , IntoArrayVariant } ;
1818
1919trait PStatsType : NativePType + Into < Scalar > + BitWidth { }
2020
2121impl < T : NativePType + Into < Scalar > + BitWidth > PStatsType for T { }
2222
2323impl ArrayStatisticsCompute for PrimitiveArray {
2424 fn compute_statistics ( & self , stat : Stat ) -> VortexResult < StatsSet > {
25+ if stat == Stat :: UncompressedSizeInBytes {
26+ return Ok ( StatsSet :: of ( stat, self . nbytes ( ) ) ) ;
27+ }
28+
2529 let mut stats = match_each_native_ptype ! ( self . ptype( ) , |$P | {
2630 match self . logical_validity( ) {
2731 LogicalValidity :: AllValid ( _) => self . maybe_null_slice:: <$P >( ) . compute_statistics( stat) ,
@@ -77,7 +81,7 @@ impl<T: PStatsType> ArrayStatisticsCompute for &[T] {
7781 self . iter ( ) . skip ( 1 ) . for_each ( |next| stats. next ( * next) ) ;
7882 stats. finish ( )
7983 }
80- Stat :: TrueCount => StatsSet :: default ( ) ,
84+ Stat :: TrueCount | Stat :: UncompressedSizeInBytes => StatsSet :: default ( ) ,
8185 } )
8286 }
8387}
@@ -87,7 +91,7 @@ struct NullableValues<'a, T: PStatsType>(&'a [T], &'a BooleanBuffer);
8791impl < T : PStatsType > ArrayStatisticsCompute for NullableValues < ' _ , T > {
8892 fn compute_statistics ( & self , stat : Stat ) -> VortexResult < StatsSet > {
8993 let values = self . 0 ;
90- if values. is_empty ( ) || stat == Stat :: TrueCount {
94+ if values. is_empty ( ) || stat == Stat :: TrueCount || stat == Stat :: UncompressedSizeInBytes {
9195 return Ok ( StatsSet :: default ( ) ) ;
9296 }
9397
0 commit comments