alamb commented on code in PR #12228:
URL: https://github.com/apache/arrow-rs/pull/12228#discussion_r4636038972
##########
arrow-array/src/builder/generic_bytes_builder.rs:
##########
@@ -201,33 +202,44 @@ impl<T: ByteArrayType> GenericByteBuilder<T> {
/// Builds the [`GenericByteArray`] and reset this builder.
pub fn finish(&mut self) -> GenericByteArray<T> {
- let array_type = T::DATA_TYPE;
- let array_builder = ArrayDataBuilder::new(array_type)
- .len(self.len())
- .add_buffer(std::mem::take(&mut self.offsets_builder).into())
- .add_buffer(std::mem::take(&mut self.value_builder).into())
- .nulls(self.null_buffer_builder.finish());
+ // SAFETY: offsets start at 0 and every append pushes the current end
of
+ // `value_builder`, so they are non-empty and monotonically increasing.
Review Comment:
I think the old code did the same unsafe thing, so let's maybe add new debug
asserts as a follow on PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]