paleolimbot commented on issue #18:
URL: https://github.com/apache/arrow-nanoarrow/issues/18#issuecomment-1212348074

   I think that makes sense! Although it may need some extra information 
(storage type + layout) to be generic. Maybe:
   
   ```c
   struct ArrowArrayView(struct ArrowArray* array, enum ArrowType storage_type, 
struct ArrowLayout layout)
   ```
   
   And then
   
   - `ArrowErrorCode ArrayViewInit(struct ArrowArrayView* array_view, struct 
ArrowArray* array, enum ArrowType storage_type)`
   - `char ArrayViewIsNull(struct ArrowArrayView* array_view, int64_t i)`
   - `int64_t ArrayViewGetInt(struct ArrowArrayView* array_view, int64_t i)`
   - ...
   
   For the buffers we should have unchecked accessors like you suggested:
   
   - `const int8_t* ArrowArrayBufferInt8(struct ArrowArray* array, int64_t i)`
   - ...
   
   It's also useful to know how long a buffer is supposed to be, which I was 
thinking of as the scope of the `struct ArrowLayout` (which is all that's 
needed to calculate that). For that we probs need a `struct ArrowBufferView { 
const uint8_t* data, int64_t size_bytes }`, although maybe it's *those* that 
should be type specific (i.e., `struct ArrowInt32BufferView { const uint32_t* 
data, int64_t size_bytes }`. Then you'd be able to do 
`ArrowArrayViewBuffer(array_view, buffer_i).data[element_i]` (although maybe 
that's too verbose).


-- 
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: issues-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to