tustvold commented on code in PR #5798:
URL: https://github.com/apache/arrow-rs/pull/5798#discussion_r1613554864
##########
arrow-array/src/array/primitive_array.rs:
##########
@@ -915,8 +964,16 @@ impl<T: ArrowPrimitiveType> PrimitiveArray<T> {
PrimitiveArray::new(values, Some(nulls))
}
- /// Returns `PrimitiveBuilder` of this primitive array for mutating its
values if the underlying
- /// data buffer is not shared by others.
+ /// Returns a `PrimitiveBuilder` for this array, suitable for mutating
values
+ /// in place.
+ ///
+ /// # Buffer Reuse
+ ///
+ /// If the underlying data buffer has no other outstanding references, the
+ /// buffer is used without copying.
+ ///
+ /// If the underlying data buffer does have outstanding references, the
+ /// buffer is cloned.
Review Comment:
This is not true, if the buffers can't be cloned it returns `Err(Self)`,
much like https://doc.rust-lang.org/std/sync/struct.Arc.html#method.try_unwrap
--
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]