You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by GitBox <gi...@apache.org> on 2022/08/11 18:01:45 UTC

[GitHub] [arrow-nanoarrow] lidavidm opened a new issue, #18: Add element-wise getters?

lidavidm opened a new issue, #18:
URL: https://github.com/apache/arrow-nanoarrow/issues/18

   This isn't strictly necessary - but I wonder what you'd think of having inline getters, things like
   
   ```c
   int ArrowArrayIsSet(struct ArrowArray* array, int64_t i) {
     // TODO: unions
     if (array->n_buffers == 0) return 0;  // NA
     if (!array->buffers[0]) return 1;     // common optimization
     return ArrowBitGet((const uint8_t*) array->buffers[0], i);
   }
   ```
   
   and other counterparts for the 'easy' appenders. (possibly also written in terms of 'unsafe' type-width-specific getters, as with the appenders.)


-- 
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-unsubscribe@arrow.apache.org.apache.org

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


[GitHub] [arrow-nanoarrow] lidavidm commented on issue #18: Add element-wise getters?

Posted by GitBox <gi...@apache.org>.
lidavidm commented on issue #18:
URL: https://github.com/apache/arrow-nanoarrow/issues/18#issuecomment-1212365892

   Hmm, wouldn't you just validate the lengths once in `ArrrayViewInit`, and then the getters could just validate the given index against the logical length already in ArrowArray?


-- 
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-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-nanoarrow] paleolimbot closed issue #18: Add element-wise getters?

Posted by GitBox <gi...@apache.org>.
paleolimbot closed issue #18: Add element-wise getters?
URL: https://github.com/apache/arrow-nanoarrow/issues/18


-- 
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-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-nanoarrow] paleolimbot commented on issue #18: Add element-wise getters?

Posted by GitBox <gi...@apache.org>.
paleolimbot commented on issue #18:
URL: https://github.com/apache/arrow-nanoarrow/issues/18#issuecomment-1212370668

   I was separating the `ArrowLayout` bit into its own PR today anyway and will play with it a bit...maybe the `ArrowBufferView is part of the `ArrayView` so that it's only calculated once as you suggested.


-- 
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-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-nanoarrow] paleolimbot commented on issue #18: Add element-wise getters?

Posted by GitBox <gi...@apache.org>.
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-unsubscribe@arrow.apache.org

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