Skip to content

Commit 7b3111a

Browse files
committed
fix: array correctly update their validity
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent df6e109 commit 7b3111a

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

vortex-array/src/arrays/varbin/array.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -491,18 +491,11 @@ impl Array<VarBin> {
491491
validity: Validity,
492492
) -> VortexResult<Self> {
493493
let len = offsets.len() - 1;
494+
let bytes = BufferHandle::new_host(bytes);
495+
VarBinData::validate(&offsets, &bytes, &dtype, &validity)?;
494496
let slots = VarBinData::make_slots(offsets, &validity, len);
495-
let data = unsafe {
496-
VarBinData::new_unchecked_from_handle(
497-
slots[OFFSETS_SLOT]
498-
.as_ref()
499-
.vortex_expect("VarBinArray offsets slot")
500-
.clone(),
501-
bytes,
502-
dtype.clone(),
503-
validity,
504-
)
505-
}?;
497+
// SAFETY: validate ensures all invariants are met.
498+
let data = unsafe { VarBinData::new_unchecked_from_handle(bytes) };
506499
Ok(unsafe {
507500
Array::from_parts_unchecked(ArrayParts::new(VarBin, dtype, len, data).with_slots(slots))
508501
})

0 commit comments

Comments
 (0)