lidavidm commented on issue #76:
URL: https://github.com/apache/arrow-nanoarrow/issues/76#issuecomment-1329620057

   I've double-checked and the array seems to be valid, except that the data 
buffer is NULL because the buffer length is 0. 
   
   So the question remains: is it valid to have non-validity buffer pointers be 
NULL in the C Data Interface? The C++ library [handles this case 
explicitly](https://github.com/apache/arrow/blob/ad54d6ca3aed0e1022d1b135817d855659d482f9/cpp/src/arrow/c/bridge.cc#L1569-L1578),
 Java [does not appear 
to](https://github.com/apache/arrow/blob/master/java/c/src/main/java/org/apache/arrow/c/BufferImportTypeVisitor.java)
 (but maybe it's done implicitly - needs testing). Go crashes when it 
[constructs the 
slice](https://github.com/apache/arrow/blob/4afe71030cdd9d3103c7b028082ba63bafdf5d27/go/arrow/cdata/cdata.go#L617):
   
   <details>
   
   ```
           panic({0x9cd620, 0xea6060})
                
/nix/store/5xayx09nj7rxwkf1c2pxzdslp4ilrv5v-go-1.18.5/share/go/src/runtime/panic.go:838
 +0x207
           
github.com/apache/arrow/go/v10/arrow/cdata.(*cimporter).importBuffer(0xc0000e8de0,
 0x1, 0x0)
                
/home/lidavidm/go/pkg/mod/github.com/apache/arrow/go/[email protected]/arrow/cdata/cdata.go:615
 +0x216
           
github.com/apache/arrow/go/v10/arrow/cdata.(*cimporter).importBitsBuffer(0xc0000b5a00?,
 0x200000003?)
                
/home/lidavidm/go/pkg/mod/github.com/apache/arrow/go/[email protected]/arrow/cdata/cdata.go:621
 +0x2c
           
github.com/apache/arrow/go/v10/arrow/cdata.(*cimporter).importFixedSizePrimitive(0xc0000e8de0)
                
/home/lidavidm/go/pkg/mod/github.com/apache/arrow/go/[email protected]/arrow/cdata/cdata.go:580
 +0x1ed
           
github.com/apache/arrow/go/v10/arrow/cdata.(*cimporter).doImport(0xc0000e8de0, 
0xc0000ace01?)
                
/home/lidavidm/go/pkg/mod/github.com/apache/arrow/go/[email protected]/arrow/cdata/cdata.go:409
 +0x11af
           
github.com/apache/arrow/go/v10/arrow/cdata.(*cimporter).importChild(0x0?, 0x0?, 
0x110000000000?)
                
/home/lidavidm/go/pkg/mod/github.com/apache/arrow/go/[email protected]/arrow/cdata/cdata.go:303
 +0x36
           
github.com/apache/arrow/go/v10/arrow/cdata.(*cimporter).doImportChildren(0xc00024a360)
                
/home/lidavidm/go/pkg/mod/github.com/apache/arrow/go/[email protected]/arrow/cdata/cdata.go:351
 +0x516
           
github.com/apache/arrow/go/v10/arrow/cdata.(*cimporter).doImport(0xc00024a360, 
0x1?)
                
/home/lidavidm/go/pkg/mod/github.com/apache/arrow/go/[email protected]/arrow/cdata/cdata.go:391
 +0x125
           
github.com/apache/arrow/go/v10/arrow/cdata.(*cimporter).importChild(0xc0000ed680?,
 0x0?, 0x555555555555?)
                
/home/lidavidm/go/pkg/mod/github.com/apache/arrow/go/[email protected]/arrow/cdata/cdata.go:303
 +0x36
           
github.com/apache/arrow/go/v10/arrow/cdata.(*cimporter).doImportChildren(0xc000099bc0)
                
/home/lidavidm/go/pkg/mod/github.com/apache/arrow/go/[email protected]/arrow/cdata/cdata.go:340
 +0x719
           
github.com/apache/arrow/go/v10/arrow/cdata.(*cimporter).doImport(0xc000099bc0, 
0x2?)
                
/home/lidavidm/go/pkg/mod/github.com/apache/arrow/go/[email protected]/arrow/cdata/cdata.go:391
 +0x125
           github.com/apache/arrow/go/v10/arrow/cdata.importCArrayAsType(...)
                
/home/lidavidm/go/pkg/mod/github.com/apache/arrow/go/[email protected]/arrow/cdata/cdata.go:653
           
github.com/apache/arrow/go/v10/arrow/cdata.ImportCRecordBatchWithSchema(0x1aa0a70?,
 0xc000099b60)
                
/home/lidavidm/go/pkg/mod/github.com/apache/arrow/go/[email protected]/arrow/cdata/interface.go:115
 +0xb5
           
github.com/apache/arrow/go/v10/arrow/cdata.(*nativeCRecordBatchReader).next(0xc00027c0c0)
   ```
   
   </details>
   
   @pitrou @zeroshade what do you think? 


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