@@ -8,10 +8,9 @@ use vortex_array::compute::{
88 IndexOrd , Len , SearchResult , SearchSorted , SearchSortedFn , SearchSortedSide ,
99 SearchSortedUsizeFn ,
1010} ;
11- use vortex_array:: validity:: Validity ;
1211use vortex_array:: variants:: PrimitiveArrayTrait ;
1312use vortex_dtype:: { match_each_unsigned_integer_ptype, DType , NativePType } ;
14- use vortex_error:: { vortex_err , VortexError , VortexResult } ;
13+ use vortex_error:: { VortexError , VortexResult } ;
1514use vortex_scalar:: Scalar ;
1615
1716use crate :: { unpack_single_primitive, BitPackedArray , BitPackedEncoding } ;
@@ -158,17 +157,8 @@ impl<'a, T: BitPacking + NativePType> BitPackedSearch<'a, T> {
158157 . map ( |p| p. min_index ( ) )
159158 . transpose ( ) ?
160159 . unwrap_or_else ( || array. len ( ) ) ;
161- let first_non_null_idx = match array. validity ( ) {
162- Validity :: NonNullable | Validity :: AllValid => 0 ,
163- Validity :: AllInvalid => array. len ( ) ,
164- Validity :: Array ( varray) => {
165- // In sorted order, nulls come before all the non-null values, i.e. we have true count worth of non null values at the end
166- array. len ( )
167- - varray. statistics ( ) . compute_true_count ( ) . ok_or_else ( || {
168- vortex_err ! ( "Couldn't compute true count for validity of bitpacked array" )
169- } ) ?
170- }
171- } ;
160+ // In sorted order, nulls come before all the non-null values, i.e. we skip invalid_count worth of entries from beginning
161+ let first_non_null_idx = array. invalid_count ( ) ?;
172162
173163 Ok ( Self {
174164 packed_as_slice : array. packed_slice :: < T > ( ) ,
0 commit comments