HaoYang670 commented on code in PR #2525:
URL: https://github.com/apache/arrow-rs/pull/2525#discussion_r950752507


##########
arrow/src/ipc/reader.rs:
##########
@@ -433,28 +395,26 @@ fn skip_field(
 fn create_primitive_array(
     field_node: &ipc::FieldNode,
     data_type: &DataType,
-    buffers: Vec<Buffer>,
+    buffers: &[Buffer],
 ) -> ArrayRef {
     let length = field_node.length() as usize;
-    let null_count = field_node.null_count() as usize;
+    let null_buffer = (field_node.null_count() > 
0).then_some(buffers[0].clone());
     let array_data = match data_type {
         Utf8 | Binary | LargeBinary | LargeUtf8 => {
-            // read 3 buffers
+            // read 3 buffers: null buffer (optional), offsets buffer and data 
buffer
             ArrayData::builder(data_type.clone())
                 .len(length)
                 .buffers(buffers[1..3].to_vec())
-                .offset(0)
-                .null_bit_buffer((null_count > 0).then(|| buffers[0].clone()))
+                .null_bit_buffer(null_buffer)
                 .build()

Review Comment:
   Will file an issue to track it.



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