Skip to content

Commit 6f93119

Browse files
committed
fix
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent d2668cf commit 6f93119

2 files changed

Lines changed: 3 additions & 18 deletions

File tree

encodings/alp/src/alp_rd/array.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use vortex_array::patches::PatchesMetadata;
2626
use vortex_array::serde::ArrayChildren;
2727
use vortex_array::stats::ArrayStats;
2828
use vortex_array::stats::StatsSetRef;
29-
use vortex_array::validity::Validity;
3029
use vortex_array::vtable;
3130
use vortex_array::vtable::ArrayId;
3231
use vortex_array::vtable::VTable;
@@ -41,7 +40,6 @@ use vortex_error::vortex_bail;
4140
use vortex_error::vortex_ensure;
4241
use vortex_error::vortex_err;
4342
use vortex_error::vortex_panic;
44-
use vortex_mask::Mask;
4543
use vortex_session::VortexSession;
4644

4745
use crate::alp_rd::kernel::PARENT_KERNELS;
@@ -302,18 +300,6 @@ impl VTable for ALPRD {
302300

303301
let left_parts_dict = array.left_parts_dictionary();
304302

305-
let nullability = array.dtype().nullability();
306-
let validity = if nullability == Nullability::NonNullable {
307-
Validity::NonNullable
308-
} else {
309-
let mask = array
310-
.left_parts()
311-
.validity()?
312-
.to_array(array.len())
313-
.execute::<Mask>(ctx)?;
314-
Validity::from_mask(mask, nullability)
315-
};
316-
317303
let decoded_array = if array.is_f32() {
318304
PrimitiveArray::new(
319305
alp_rd_decode::<f32>(
@@ -324,7 +310,7 @@ impl VTable for ALPRD {
324310
array.left_parts_patches(),
325311
ctx,
326312
)?,
327-
validity,
313+
array.left_parts().validity()?.clone(),
328314
)
329315
} else {
330316
PrimitiveArray::new(
@@ -336,7 +322,7 @@ impl VTable for ALPRD {
336322
array.left_parts_patches(),
337323
ctx,
338324
)?,
339-
validity,
325+
array.left_parts().validity()?.clone(),
340326
)
341327
};
342328

encodings/alp/src/alp_rd/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,7 @@ pub fn alp_rd_decode<T: ALPRDFloat>(
306306

307307
if let Some(patches) = left_parts_patches {
308308
for code in left_parts.iter_mut() {
309-
// SAFETY: The encoder guarantees all codes are valid indices into left_parts_dict.
310-
*code = unsafe { *left_parts_dict.get_unchecked(*code as usize) };
309+
*code = left_parts_dict[*code as usize];
311310
}
312311
let indices = patches.indices().clone().execute::<PrimitiveArray>(ctx)?;
313312
let patch_values = patches.values().clone().execute::<PrimitiveArray>(ctx)?;

0 commit comments

Comments
 (0)