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


##########
arrow-array/src/array/fixed_size_binary_array.rs:
##########
@@ -497,24 +497,25 @@ impl FixedSizeBinaryArray {
 
 impl From<ArrayData> for FixedSizeBinaryArray {
     fn from(data: ArrayData) -> Self {
+        let (data_type, len, nulls, offset, buffers, _child_data) = 
data.into_parts();
+
         assert_eq!(
-            data.buffers().len(),
+            buffers.len(),
             1,
             "FixedSizeBinaryArray data should contain 1 buffer only (values)"
         );
-        let value_length = match data.data_type() {
-            DataType::FixedSizeBinary(len) => *len,
+        let value_length = match data_type {
+            DataType::FixedSizeBinary(len) => len,
             _ => panic!("Expected data type to be FixedSizeBinary"),
         };
 
         let size = value_length as usize;
-        let value_data =
-            data.buffers()[0].slice_with_length(data.offset() * size, 
data.len() * size);
+        let value_data = buffers[0].slice_with_length(offset * size, len * 
size);
 
         Self {
-            data_type: data.data_type().clone(),
-            nulls: data.nulls().cloned(),
-            len: data.len(),
+            data_type,
+            nulls,

Review Comment:
   this saves a clone of NullBuffer and a drop of DataType
   
   I don't expect this to make much of a performance difference but it will 
help and I want all the `From<ArrayData>` impls to be consistent



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