@@ -106,15 +106,15 @@ impl rle::RLEConfig for FloatRLEConfig {
106106
107107impl RLEStats for FloatStats {
108108 fn value_count ( & self ) -> u32 {
109- self . value_count
109+ FloatStats :: value_count ( self )
110110 }
111111
112112 fn average_run_length ( & self ) -> u32 {
113- self . average_run_length
113+ FloatStats :: average_run_length ( self )
114114 }
115115
116116 fn source ( & self ) -> & PrimitiveArray {
117- & self . src
117+ FloatStats :: source ( self )
118118 }
119119}
120120
@@ -178,13 +178,13 @@ impl Scheme for ConstantScheme {
178178
179179 let stats = data. float_stats ( ) ;
180180
181- if stats. null_count as usize == stats. src . len ( ) || stats. value_count == 0 {
181+ if stats. null_count ( ) as usize == stats. source ( ) . len ( ) || stats. value_count ( ) == 0 {
182182 return Ok ( 0.0 ) ;
183183 }
184184
185185 // Can only have 1 distinct value.
186186 if stats. distinct_count ( ) . is_some_and ( |count| count == 1 ) {
187- return Ok ( stats. value_count as f64 ) ;
187+ return Ok ( stats. value_count ( ) as f64 ) ;
188188 }
189189
190190 Ok ( 0.0 )
@@ -205,16 +205,19 @@ impl Scheme for ConstantScheme {
205205 match scalar_idx {
206206 Some ( idx) => {
207207 let scalar = stats. source ( ) . scalar_at ( idx) ?;
208- let const_arr = ConstantArray :: new ( scalar, stats. src . len ( ) ) . into_array ( ) ;
208+ let const_arr = ConstantArray :: new ( scalar, stats. source ( ) . len ( ) ) . into_array ( ) ;
209209 if !stats. source ( ) . all_valid ( ) ? {
210- Ok ( MaskedArray :: try_new ( const_arr, stats. src . validity ( ) . clone ( ) ) ?. into_array ( ) )
210+ Ok (
211+ MaskedArray :: try_new ( const_arr, stats. source ( ) . validity ( ) . clone ( ) ) ?
212+ . into_array ( ) ,
213+ )
211214 } else {
212215 Ok ( const_arr)
213216 }
214217 }
215218 None => Ok ( ConstantArray :: new (
216- Scalar :: null ( stats. src . dtype ( ) . clone ( ) ) ,
217- stats. src . len ( ) ,
219+ Scalar :: null ( stats. source ( ) . dtype ( ) . clone ( ) ) ,
220+ stats. source ( ) . len ( ) ,
218221 )
219222 . into_array ( ) ) ,
220223 }
@@ -250,7 +253,7 @@ impl Scheme for ALPScheme {
250253 return Ok ( 0.0 ) ;
251254 }
252255
253- estimate_compression_ratio_with_sampling ( self , compressor, data, ctx, excludes)
256+ estimate_compression_ratio_with_sampling ( self , compressor, data. array ( ) , ctx, excludes)
254257 }
255258
256259 fn compress (
@@ -311,7 +314,7 @@ impl Scheme for ALPRDScheme {
311314 return Ok ( 0.0 ) ;
312315 }
313316
314- estimate_compression_ratio_with_sampling ( self , compressor, data, ctx, excludes)
317+ estimate_compression_ratio_with_sampling ( self , compressor, data. array ( ) , ctx, excludes)
315318 }
316319
317320 fn compress (
@@ -365,18 +368,24 @@ impl Scheme for DictScheme {
365368 ) -> VortexResult < f64 > {
366369 let stats = data. float_stats ( ) ;
367370
368- if stats. value_count == 0 {
371+ if stats. value_count ( ) == 0 {
369372 return Ok ( 0.0 ) ;
370373 }
371374
372375 // If the array is high cardinality (>50% unique values), we do not want to compress as a
373376 // dictionary.
374377 if stats
375378 . distinct_count ( )
376- . is_some_and ( |count| count <= stats. value_count / 2 )
379+ . is_some_and ( |count| count <= stats. value_count ( ) / 2 )
377380 {
378381 // Take a sample and run compression on the sample to determine before/after size.
379- return estimate_compression_ratio_with_sampling ( self , compressor, data, ctx, excludes) ;
382+ return estimate_compression_ratio_with_sampling (
383+ self ,
384+ compressor,
385+ data. array ( ) ,
386+ ctx,
387+ excludes,
388+ ) ;
380389 }
381390
382391 Ok ( 0.0 )
@@ -442,14 +451,14 @@ impl Scheme for NullDominated {
442451
443452 let stats = data. float_stats ( ) ;
444453
445- if stats. value_count == 0 {
454+ if stats. value_count ( ) == 0 {
446455 // All nulls should use ConstantScheme.
447456 return Ok ( 0.0 ) ;
448457 }
449458
450459 // If the majority is null, will compress well.
451- if stats. null_count as f64 / stats. src . len ( ) as f64 > 0.9 {
452- return Ok ( stats. src . len ( ) as f64 / stats. value_count as f64 ) ;
460+ if stats. null_count ( ) as f64 / stats. source ( ) . len ( ) as f64 > 0.9 {
461+ return Ok ( stats. source ( ) . len ( ) as f64 / stats. value_count ( ) as f64 ) ;
453462 }
454463
455464 // Otherwise we don't go this route.
@@ -468,7 +477,7 @@ impl Scheme for NullDominated {
468477 let stats = data. float_stats ( ) ;
469478
470479 // We pass None as we only run this pathway for NULL-dominated float arrays.
471- let sparse_encoded = SparseArray :: encode ( & stats. src . clone ( ) . into_array ( ) , None ) ?;
480+ let sparse_encoded = SparseArray :: encode ( & stats. source ( ) . clone ( ) . into_array ( ) , None ) ?;
472481
473482 if let Some ( sparse) = sparse_encoded. as_opt :: < Sparse > ( ) {
474483 let indices = sparse. patches ( ) . indices ( ) . to_primitive ( ) . narrow ( ) ?;
0 commit comments