diff --git a/arrow-array/src/array/byte_array.rs b/arrow-array/src/array/byte_array.rs index ffabb6e174f5..662490c9dda0 100644 --- a/arrow-array/src/array/byte_array.rs +++ b/arrow-array/src/array/byte_array.rs @@ -106,6 +106,24 @@ impl GenericByteArray { }) } + /// 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, + values: Buffer, + nulls: Option, + ) -> 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 {