@@ -6,7 +6,7 @@ use itertools::Itertools;
66use num_traits:: AsPrimitive ;
77use vortex_array:: Array ;
88use vortex_array:: compute:: {
9- IndexOrd , SearchResult , SearchSorted , SearchSortedFn , SearchSortedSide , SearchSortedUsizeFn ,
9+ IndexOrd , SearchResult , SearchSorted , SearchSortedFn , SearchSortedSide ,
1010} ;
1111use vortex_array:: variants:: PrimitiveArrayTrait ;
1212use vortex_dtype:: { DType , NativePType , match_each_unsigned_integer_ptype} ;
@@ -50,46 +50,6 @@ impl SearchSortedFn<&BitPackedArray> for BitPackedEncoding {
5050 }
5151}
5252
53- impl SearchSortedUsizeFn < & BitPackedArray > for BitPackedEncoding {
54- fn search_sorted_usize (
55- & self ,
56- array : & BitPackedArray ,
57- value : usize ,
58- side : SearchSortedSide ,
59- ) -> VortexResult < SearchResult > {
60- match_each_unsigned_integer_ptype ! ( array. ptype( ) . to_unsigned( ) , |$P | {
61- // NOTE: conversion may truncate silently.
62- if let Some ( pvalue) = num_traits:: cast:: <usize , $P >( value) {
63- search_sorted_native( array, pvalue, side)
64- } else {
65- // provided u64 is too large to fit in the provided PType, value must be off
66- // the right end of the array.
67- Ok ( SearchResult :: NotFound ( array. len( ) ) )
68- }
69- } )
70- }
71-
72- fn search_sorted_usize_many (
73- & self ,
74- array : & BitPackedArray ,
75- values : & [ usize ] ,
76- side : SearchSortedSide ,
77- ) -> VortexResult < Vec < SearchResult > > {
78- match_each_unsigned_integer_ptype ! ( array. ptype( ) . to_unsigned( ) , |$P | {
79- let searcher = BitPackedSearch :: <' _, $P >:: try_new( array) ?;
80-
81- values
82- . iter( )
83- . map( |& value| {
84- // NOTE: truncating cast
85- let cast_value: $P = value as $P ;
86- Ok ( searcher. search_sorted( & cast_value, side) )
87- } )
88- . try_collect( )
89- } )
90- }
91- }
92-
9353fn search_sorted_typed < T > (
9454 array : & BitPackedArray ,
9555 value : & Scalar ,
@@ -191,7 +151,7 @@ impl<T: BitPacking + NativePType> IndexOrd<T> for BitPackedSearch<'_, T> {
191151 Some ( val. total_compare ( * elem) )
192152 }
193153
194- fn len ( & self ) -> usize {
154+ fn index_len ( & self ) -> usize {
195155 self . length
196156 }
197157}
@@ -206,6 +166,7 @@ mod test {
206166 SearchResult , SearchSortedSide , search_sorted, search_sorted_many,
207167 } ;
208168 use vortex_array:: validity:: Validity ;
169+ use vortex_array:: variants:: PrimitiveArrayTrait ;
209170 use vortex_array:: { Array , ArrayRef , IntoArray , ToCanonical } ;
210171 use vortex_buffer:: buffer;
211172 use vortex_error:: VortexUnwrap ;
@@ -219,8 +180,6 @@ mod test {
219180 #[ case] side : SearchSortedSide ,
220181 #[ case] expected : SearchResult ,
221182 ) {
222- use vortex_array:: variants:: PrimitiveArrayTrait ;
223-
224183 let primitive_array = array. to_primitive ( ) . vortex_unwrap ( ) ;
225184 // force patches
226185 let histogram = bit_width_histogram ( & primitive_array) . vortex_unwrap ( ) ;
0 commit comments