alamb commented on code in PR #9114:
URL: https://github.com/apache/arrow-rs/pull/9114#discussion_r2686748551


##########
arrow-array/src/array/byte_view_array.rs:
##########
@@ -967,15 +967,16 @@ impl<'a, T: ByteViewType + ?Sized> IntoIterator for &'a 
GenericByteViewArray<T>
 }
 
 impl<T: ByteViewType + ?Sized> From<ArrayData> for GenericByteViewArray<T> {
-    fn from(value: ArrayData) -> Self {
-        let views = value.buffers()[0].clone();
-        let views = ScalarBuffer::new(views, value.offset(), value.len());
-        let buffers = value.buffers()[1..].to_vec().into();
+    fn from(data: ArrayData) -> Self {
+        let (_data_type, len, nulls, offset, mut buffers, _child_data) = 
data.into_parts();
+        let views = buffers.remove(0); // need to maintain order of remaining 
buffers
+        let buffers = buffers.into(); // convert to Arc

Review Comment:
   For some reason, I thought that Arc::from(..) a `Vec` was zero copy and 
reused the Vec's allocation. However, the docs seem to imply otherwise:
   
   
https://doc.rust-lang.org/std/sync/struct.Arc.html#impl-FromIterator%3CT%3E-for-Arc%3C%5BT%5D%3E
   
   <img width="1062" height="328" alt="Screenshot 2026-01-13 at 9 43 37 AM" 
src="https://github.com/user-attachments/assets/4158262f-4f7f-4307-9d19-81796ad59ef2";
 />
   
   As does the source:https://doc.rust-lang.org/src/alloc/sync.rs.html#3845-3846
   
   <img width="1120" height="582" alt="Screenshot 2026-01-13 at 9 44 46 AM" 
src="https://github.com/user-attachments/assets/3ff9a200-3344-4e90-adce-0ae008470aee";
 />
   
   



-- 
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]

Reply via email to