Skip to content

Commit

Permalink
Add new_unchecked
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold committed Apr 13, 2023
1 parent 0d2ce17 commit 7a9bf3a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions arrow-array/src/array/byte_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,24 @@ impl<T: ByteArrayType> GenericByteArray<T> {
})
}

/// Create a new [`GenericByteArray`] from the provided parts, without validation
///
/// # Safety
///
/// Safe if [`Self::try_new`] would not error
pub fn new_unchecked(
offsets: OffsetBuffer<T::Offset>,
values: Buffer,
nulls: Option<NullBuffer>,
) -> Self {
Self {
data_type: T::DATA_TYPE,
value_offsets: offsets,
value_data: values,
nulls,
}
}

/// Create a new [`GenericByteArray`] of length `len` where all values are null
pub fn new_null(len: usize) -> Self {
Self {
Expand Down

0 comments on commit 7a9bf3a

Please sign in to comment.