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


##########
arrow/src/ffi.rs:
##########
@@ -657,13 +657,20 @@ 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
-                        ))
-                    })
+                match unsafe {
+                    create_buffer(self.owner().clone(), self.array(), index, 
len)
+                } {
+                    Some(buf) => Ok(buf),
+                    None if len == 0 => {
+                        // Null data buffer, which Rust doesn't allow. So 
create

Review Comment:
   :+1:
   
   FWIW we do actually just use a null-like sentinel but it isn't null. This is 
a bit questionable, if I have time I might revisit the use of `NonNull` in the 
low-level alloc interfaces.
   
   Edit: https://github.com/apache/arrow-rs/pull/3289



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