@@ -21,7 +21,8 @@ use vortex_array::dtype::PType;
2121use vortex_array:: expr:: Expression ;
2222use vortex_array:: expr:: stats:: Precision ;
2323use vortex_array:: expr:: stats:: Stat ;
24- use vortex_array:: scalar_fn:: fns:: stats_expression:: { contains_stats_fn_array, substitute_stats_fn_array} ;
24+ use vortex_array:: scalar_fn:: fns:: stats_expression:: contains_stats_fn_array;
25+ use vortex_array:: scalar_fn:: fns:: stats_expression:: substitute_stats_fn_array;
2526use vortex_array:: stats:: StatsSet ;
2627use vortex_array:: validity:: Validity ;
2728use vortex_buffer:: buffer;
@@ -44,7 +45,7 @@ pub struct ZoneMap {
4445 // The statistics that are included in the table.
4546 stats : Arc < [ Stat ] > ,
4647 // The length of each zone in the zone map.
47- zone_len : usize ,
48+ zone_len : u64 ,
4849 // Number of rows that the zone map covers
4950 row_count : u64 ,
5051}
@@ -56,7 +57,7 @@ impl ZoneMap {
5657 column_dtype : DType ,
5758 array : StructArray ,
5859 stats : Arc < [ Stat ] > ,
59- zone_len : usize ,
60+ zone_len : u64 ,
6061 row_count : u64 ,
6162 ) -> VortexResult < Self > {
6263 let expected_dtype = stats_table_dtype ( & column_dtype, & stats) ;
@@ -76,7 +77,7 @@ impl ZoneMap {
7677 pub unsafe fn new_unchecked (
7778 array : StructArray ,
7879 stats : Arc < [ Stat ] > ,
79- zone_len : usize ,
80+ zone_len : u64 ,
8081 row_count : u64 ,
8182 ) -> Self {
8283 Self {
@@ -156,11 +157,7 @@ impl ZoneMap {
156157 /// [`ConstantArray`]; a short final zone uses a run-end encoded array.
157158 ///
158159 /// [`checked_pruning_expr`]: vortex_array::expr::pruning::checked_pruning_expr
159- pub fn prune (
160- & self ,
161- predicate : & Expression ,
162- session : & VortexSession ,
163- ) -> VortexResult < Mask > {
160+ pub fn prune ( & self , predicate : & Expression , session : & VortexSession ) -> VortexResult < Mask > {
164161 let mut ctx = session. create_execution_ctx ( ) ;
165162 let num_zones = self . array . len ( ) ;
166163
@@ -170,7 +167,8 @@ impl ZoneMap {
170167 return applied. execute :: < Mask > ( & mut ctx) ;
171168 }
172169
173- let row_count_array = row_count_array ( self . zone_len , self . row_count , num_zones, & mut ctx) ?;
170+ let row_count_array =
171+ row_count_array ( self . zone_len , self . row_count , num_zones, & mut ctx) ?;
174172 let substituted = substitute_stats_fn_array :: < RowCount > ( applied, & row_count_array) ?;
175173 substituted. execute :: < Mask > ( & mut ctx)
176174 }
@@ -182,7 +180,7 @@ impl ZoneMap {
182180/// result is a [`ConstantArray`] for uniform zone sizes, otherwise a two-run
183181/// run-end encoded array whose trailing run carries the final zone length.
184182fn row_count_array (
185- zone_len : usize ,
183+ zone_len : u64 ,
186184 row_count : u64 ,
187185 num_zones : usize ,
188186 ctx : & mut ExecutionCtx ,
@@ -276,6 +274,7 @@ mod tests {
276274 ] )
277275 . unwrap ( ) ,
278276 Arc :: new ( [ Stat :: Max , Stat :: Min ] ) ,
277+ 3 ,
279278 10 ,
280279 )
281280 . unwrap ( ) ;
@@ -284,7 +283,7 @@ mod tests {
284283 // => A.max < 6
285284 let expr = gt_eq ( root ( ) , lit ( 6i32 ) ) ;
286285 let ( pruning_expr, _) = checked_pruning_expr ( & expr, & stats) . unwrap ( ) ;
287- let mask = zone_map. prune ( & pruning_expr, 1 , 3 , & SESSION ) . unwrap ( ) ;
286+ let mask = zone_map. prune ( & pruning_expr, & SESSION ) . unwrap ( ) ;
288287 assert_arrays_eq ! (
289288 mask. into_array( ) ,
290289 BoolArray :: from_iter( [ true , false , false ] )
@@ -294,7 +293,7 @@ mod tests {
294293 // => A.max <= 5
295294 let expr = gt ( root ( ) , lit ( 5i32 ) ) ;
296295 let ( pruning_expr, _) = checked_pruning_expr ( & expr, & stats) . unwrap ( ) ;
297- let mask = zone_map. prune ( & pruning_expr, 1 , 3 , & SESSION ) . unwrap ( ) ;
296+ let mask = zone_map. prune ( & pruning_expr, & SESSION ) . unwrap ( ) ;
298297 assert_arrays_eq ! (
299298 mask. into_array( ) ,
300299 BoolArray :: from_iter( [ true , false , false ] )
@@ -304,7 +303,7 @@ mod tests {
304303 // => A.min >= 2
305304 let expr = lt ( root ( ) , lit ( 2i32 ) ) ;
306305 let ( pruning_expr, _) = checked_pruning_expr ( & expr, & stats) . unwrap ( ) ;
307- let mask = zone_map. prune ( & pruning_expr, 1 , 3 , & SESSION ) . unwrap ( ) ;
306+ let mask = zone_map. prune ( & pruning_expr, & SESSION ) . unwrap ( ) ;
308307 assert_arrays_eq ! ( mask. into_array( ) , BoolArray :: from_iter( [ false , true , true ] ) ) ;
309308 }
310309
@@ -318,6 +317,8 @@ mod tests {
318317 ) ] )
319318 . unwrap ( ) ,
320319 Arc :: new ( [ Stat :: NullCount ] ) ,
320+ 4 ,
321+ 10 ,
321322 )
322323 . unwrap ( ) ;
323324
@@ -326,7 +327,7 @@ mod tests {
326327 let expr = is_not_null ( root ( ) ) ;
327328 let ( pruning_expr, _) = checked_pruning_expr ( & expr, & available_stats) . unwrap ( ) ;
328329
329- let mask = zone_map. prune ( & pruning_expr, 4 , 10 , & SESSION ) . unwrap ( ) ;
330+ let mask = zone_map. prune ( & pruning_expr, & SESSION ) . unwrap ( ) ;
330331 assert_arrays_eq ! (
331332 mask. into_array( ) ,
332333 BoolArray :: from_iter( [ false , false , true ] )
@@ -343,6 +344,8 @@ mod tests {
343344 ) ] )
344345 . unwrap ( ) ,
345346 Arc :: new ( [ Stat :: NullCount ] ) ,
347+ 4 ,
348+ 12 ,
346349 )
347350 . unwrap ( ) ;
348351
@@ -352,7 +355,7 @@ mod tests {
352355 let ( pruning_expr, _) = checked_pruning_expr ( & expr, & available_stats) . unwrap ( ) ;
353356
354357 // All three zones have length 4 (total rows = 12).
355- let mask = zone_map. prune ( & pruning_expr, 4 , 12 , & SESSION ) . unwrap ( ) ;
358+ let mask = zone_map. prune ( & pruning_expr, & SESSION ) . unwrap ( ) ;
356359 assert_arrays_eq ! (
357360 mask. into_array( ) ,
358361 BoolArray :: from_iter( [ false , true , false ] )
0 commit comments