viirya commented on code in PR #3115:
URL: https://github.com/apache/arrow-rs/pull/3115#discussion_r1023552250
##########
arrow-array/src/array/primitive_array.rs:
##########
@@ -489,6 +544,42 @@ impl<T: ArrowPrimitiveType> PrimitiveArray<T> {
)
}
}
+
+ /// Returns `PrimitiveBuilder` of this primitive array for mutating its
values if the underlying
+ /// data buffer is not shared by others.
+ pub fn into_builder(self) -> Result<PrimitiveBuilder<T>, Self> {
+ let null_buffer = self
+ .data
+ .null_buffer()
+ .cloned()
+ .and_then(|b| b.into_mutable(0).ok());
+
+ let len = self.len();
+ let null_bit_buffer = self.data.null_buffer().cloned();
+
+ let buffer = self.data.buffers()[0].clone();
Review Comment:
I changed to `slice_with_length` but I'm wondering what's difference than
`clone` directly here?
--
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]