File tree Expand file tree Collapse file tree
vortex-compute/src/filter Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ use vortex_buffer::BitView;
1616use vortex_buffer:: Buffer ;
1717use vortex_buffer:: BufferMut ;
1818use vortex_mask:: Mask ;
19+ use vortex_mask:: MaskIter ;
1920use vortex_mask:: MaskValues ;
2021
2122use crate :: filter:: Filter ;
@@ -45,16 +46,9 @@ impl<T: Copy> Filter<MaskValues> for &[T] {
4546 "Selection mask length must equal the buffer length"
4647 ) ;
4748
48- if mask_values. density ( ) >= FILTER_SLICES_SELECTIVITY_THRESHOLD {
49- // High density: use slices (contiguous ranges)
50- self . filter ( mask_values. slices ( ) )
51- } else {
52- // Low density: stream indices directly from bitmap without allocating
53- let mut out = BufferMut :: < T > :: with_capacity ( mask_values. true_count ( ) ) ;
54- for idx in mask_values. bit_buffer ( ) . set_indices ( ) {
55- out. push ( self [ idx] ) ;
56- }
57- out. freeze ( )
49+ match mask_values. threshold_iter ( FILTER_SLICES_SELECTIVITY_THRESHOLD ) {
50+ MaskIter :: Indices ( indices) => self . filter ( indices) ,
51+ MaskIter :: Slices ( slices) => self . filter ( slices) ,
5852 }
5953 }
6054}
You can’t perform that action at this time.
0 commit comments