Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions encodings/fastlanes/src/bitpacking/array/bitpack_decompress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub(crate) fn unpack_into_primitive_builder<T: BitPacked>(
bit_packed_iter.decode_into(uninit_slice);

if let Some(patches) = array.patches() {
apply_patches(&mut uninit_range, patches);
apply_patches_to_uninit_range(&mut uninit_range, patches);
};

// SAFETY: We have set a correct validity mask via `append_mask` with `array.len()` values and
Expand All @@ -63,11 +63,11 @@ pub(crate) fn unpack_into_primitive_builder<T: BitPacked>(
}
}

pub fn apply_patches<T: NativePType>(dst: &mut UninitRange<T>, patches: &Patches) {
apply_patches_fn(dst, patches, |x| x)
pub fn apply_patches_to_uninit_range<T: NativePType>(dst: &mut UninitRange<T>, patches: &Patches) {
apply_patches_to_uninit_range_fn(dst, patches, |x| x)
}

pub fn apply_patches_fn<T: NativePType, F: Fn(T) -> T>(
pub fn apply_patches_to_uninit_range_fn<T: NativePType, F: Fn(T) -> T>(
dst: &mut UninitRange<T>,
patches: &Patches,
f: F,
Expand All @@ -80,7 +80,7 @@ pub fn apply_patches_fn<T: NativePType, F: Fn(T) -> T>(
let values = values.as_slice::<T>();

match_each_unsigned_integer_ptype!(indices.ptype(), |P| {
insert_values_and_validity_at_indices(
insert_values_and_validity_at_indices_to_uninit_range(
dst,
indices.as_slice::<P>(),
values,
Expand All @@ -91,7 +91,11 @@ pub fn apply_patches_fn<T: NativePType, F: Fn(T) -> T>(
});
}

fn insert_values_and_validity_at_indices<T: NativePType, IndexT: IntegerPType, F: Fn(T) -> T>(
fn insert_values_and_validity_at_indices_to_uninit_range<
T: NativePType,
IndexT: IntegerPType,
F: Fn(T) -> T,
>(
dst: &mut UninitRange<T>,
indices: &[IndexT],
values: &[T],
Expand Down
4 changes: 3 additions & 1 deletion encodings/fastlanes/src/for/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ fn fused_decompress<T: PhysicalPType<Physical = T> + UnsignedPType + FoR + Wrapp
unpacked.decode_into(uninit_slice);

if let Some(patches) = bp.patches() {
bitpack_decompress::apply_patches_fn(&mut uninit_range, patches, |v| v.wrapping_add(&ref_));
bitpack_decompress::apply_patches_to_uninit_range_fn(&mut uninit_range, patches, |v| {
v.wrapping_add(&ref_)
});
};

// SAFETY: We have set a correct validity mask via `append_mask` with `array.len()` values and
Expand Down
Loading