ctsk commented on code in PR #7773:
URL: https://github.com/apache/arrow-rs/pull/7773#discussion_r2173174118
##########
arrow-array/src/array/byte_view_array.rs:
##########
@@ -609,8 +617,9 @@ impl<T: ByteViewType + ?Sized> Array for
GenericByteViewArray<T> {
fn shrink_to_fit(&mut self) {
self.views.shrink_to_fit();
- self.buffers.iter_mut().for_each(|b| b.shrink_to_fit());
- self.buffers.shrink_to_fit();
+ if let Some(buffers) = Arc::get_mut(&mut self.buffers.0) {
Review Comment:
The underlying Buffers are reference counted too, and only shrink themselves
if the reference count is 0. So while this does change the semantics slightly,
I don't think it changes as much in practice: When the Arc is shared, the
(current) alternative would be to store references to the same buffers in
another Vec - thus incrementing the reference counts on the underlying buffers
and making their `shrink_to_fit` a no-op.
That's also why `make_mut` wont lead to more shrinking
--
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]