Skip to content

Commit c709a61

Browse files
committed
Remove patches from BitPackedArray
removes both the patches field as well as all code for handling patches. this is safe to do now that we have updated the VTable build function to always read methods. note that we need to leave the metadata as-is. Signed-off-by: Andrew Duffy <andrew@a10y.dev>
1 parent a92a971 commit c709a61

File tree

34 files changed

+2307
-2116
lines changed

34 files changed

+2307
-2116
lines changed

encodings/alp/src/alp_rd/mod.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use vortex_array::ExecutionCtx;
88
use vortex_array::IntoArray;
99
use vortex_array::patches::Patches;
1010
use vortex_array::validity::Validity;
11+
use vortex_fastlanes::bitpack_compress::BitPackedEncoder;
1112
use vortex_fastlanes::bitpack_compress::bitpack_encode_unchecked;
1213

1314
mod array;
@@ -230,20 +231,19 @@ impl RDEncoder {
230231

231232
// Bit-pack down the encoded left-parts array that have been dictionary encoded.
232233
let primitive_left = PrimitiveArray::new(left_parts, array.validity().clone());
233-
// SAFETY: by construction, all values in left_parts can be packed to left_bit_width.
234-
let packed_left = unsafe {
235-
bitpack_encode_unchecked(primitive_left, left_bit_width as _)
236-
.vortex_expect("bitpack_encode_unchecked should succeed for left parts")
237-
.into_array()
238-
};
239-
234+
let packed_left = BitPackedEncoder::new(&primitive_left)
235+
.with_bit_width(left_bit_width as _)
236+
.pack()
237+
.vortex_expect("bitpack_encode_unchecked should succeed for left parts")
238+
.into_array()
239+
.vortex_expect("Packed::into_array");
240240
let primitive_right = PrimitiveArray::new(right_parts, Validity::NonNullable);
241-
// SAFETY: by construction, all values in right_parts are right_bit_width + leading zeros.
242-
let packed_right = unsafe {
243-
bitpack_encode_unchecked(primitive_right, self.right_bit_width as _)
244-
.vortex_expect("bitpack_encode_unchecked should succeed for right parts")
245-
.into_array()
246-
};
241+
let packed_right = BitPackedEncoder::new(&primitive_right)
242+
.with_bit_width(self.right_bit_width as _)
243+
.pack()
244+
.vortex_expect("bitpack_encode_unchecked should succeed for right parts")
245+
.into_array()
246+
.vortex_expect("Packed::into_array");
247247

248248
// Bit-pack the dict-encoded left-parts
249249
// Bit-pack the right-parts

encodings/fastlanes/benches/bitpacking_take.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,6 @@ fn patched_take_10_stratified(bencher: Bencher) {
161161
let uncompressed = PrimitiveArray::new(values, Validity::NonNullable);
162162
let packed = bitpack_to_best_bit_width(&uncompressed).unwrap();
163163

164-
assert!(packed.patches().is_some());
165-
assert_eq!(
166-
packed.patches().unwrap().num_patches(),
167-
NUM_EXCEPTIONS as usize
168-
);
169-
170164
let indices = PrimitiveArray::from_iter((0..10).map(|i| i * 6_653));
171165

172166
bencher
@@ -186,12 +180,6 @@ fn patched_take_10_contiguous(bencher: Bencher) {
186180
let uncompressed = PrimitiveArray::new(values, Validity::NonNullable);
187181
let packed = bitpack_to_best_bit_width(&uncompressed).unwrap();
188182

189-
assert!(packed.patches().is_some());
190-
assert_eq!(
191-
packed.patches().unwrap().num_patches(),
192-
NUM_EXCEPTIONS as usize
193-
);
194-
195183
let indices = buffer![0..10].into_array();
196184

197185
bencher
@@ -250,12 +238,6 @@ fn patched_take_10k_contiguous_patches(bencher: Bencher) {
250238
let uncompressed = PrimitiveArray::new(values, Validity::NonNullable);
251239
let packed = bitpack_to_best_bit_width(&uncompressed).unwrap();
252240

253-
assert!(packed.patches().is_some());
254-
assert_eq!(
255-
packed.patches().unwrap().num_patches(),
256-
NUM_EXCEPTIONS as usize
257-
);
258-
259241
let indices =
260242
PrimitiveArray::from_iter((BIG_BASE2..BIG_BASE2 + NUM_EXCEPTIONS).cycle().take(10000));
261243

0 commit comments

Comments
 (0)