Skip to content
Merged
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
15 changes: 9 additions & 6 deletions vortex-array/src/arrow/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,15 @@ where
DataType::Utf8 | DataType::LargeUtf8 => DType::Utf8(nullable.into()),
dt => vortex_panic!("Invalid data type for ByteArray: {dt}"),
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least to a debug assert here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new_unchecked has this under new_unchecked_from_handle:

        #[cfg(debug_assertions)]
        Self::validate(&offsets, &bytes, &dtype, &validity)
            .vortex_expect("[Debug Assertion]: Invalid `VarBinArray` parameters");

so we already have dbg assert validate here

Ok(VarBinArray::try_new(
value.offsets().clone().into_array(),
ByteBuffer::from_arrow_buffer(value.values().clone(), Alignment::of::<u8>()),
dtype,
nulls(value.nulls(), nullable),
)?
// SAFETY: Arrow arrays are already validated (valid UTF-8, valid offsets, correct validity).
Ok(unsafe {
VarBinArray::new_unchecked(
value.offsets().clone().into_array(),
ByteBuffer::from_arrow_buffer(value.values().clone(), Alignment::of::<u8>()),
dtype,
nulls(value.nulls(), nullable),
)
}
.into_array())
}
}
Expand Down
Loading