viirya commented on code in PR #3276:
URL: https://github.com/apache/arrow-rs/pull/3276#discussion_r1042581555


##########
arrow/src/ffi.rs:
##########
@@ -657,13 +657,14 @@ pub trait ArrowArrayRef {
 
                 let len = self.buffer_len(index)?;
 
-                unsafe { create_buffer(self.owner().clone(), self.array(), 
index, len) }
-                    .ok_or_else(|| {
-                        ArrowError::CDataInterface(format!(
-                            "The external buffer at position {} is null.",
-                            index - 1
-                        ))
-                    })
+                Ok(unsafe {
+                    create_buffer(self.owner().clone(), self.array(), index, 
len)
+                }
+                .unwrap_or_else(|| {
+                    // Null data buffer, which Rust doesn't allow. So create
+                    // an empty buffer.
+                    MutableBuffer::new(0).into()

Review Comment:
   Should we create an empty buffer only if the buffer length is 0? I think it 
is more following the spec. Otherwise we should still return the original 
`ArrowError`.



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