jhorstmann commented on code in PR #6336:
URL: https://github.com/apache/arrow-rs/pull/6336#discussion_r1741964750


##########
arrow-buffer/src/buffer/mutable.rs:
##########
@@ -517,8 +674,18 @@ impl<T: ArrowNativeType> From<Vec<T>> for MutableBuffer {
         // Vec guaranteed to have a valid layout matching that of 
`Layout::array`
         // This is based on `RawVec::current_memory`
         let layout = unsafe { 
Layout::array::<T>(value.capacity()).unwrap_unchecked() };
+        let zelf = Self {
+            data,
+            len,
+            layout,
+            #[cfg(not(feature = "allocator_api"))]
+            allocator: Global,
+            #[cfg(feature = "allocator_api")]
+            allocator: *value.allocator(),

Review Comment:
   The `From` impl would benefit from having a type parameter for the 
allocator, otherwise the allocator here would always implicitly be the global 
one. That probably requires two separate impl blocks depending on the feature 
flag.
   
   The same would be useful for `Buffer::from_vec(Vec)`.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to