You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Antoine Pitrou (JIRA)" <ji...@apache.org> on 2018/10/10 08:24:00 UTC

[jira] [Commented] (ARROW-3478) [C++] API add value / null mask buffer accessor to ArrayData

    [ https://issues.apache.org/jira/browse/ARROW-3478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16644615#comment-16644615 ] 

Antoine Pitrou commented on ARROW-3478:
---------------------------------------

> The buffers will (from reading the code) either be [null_mask, data] or [data] (if the null mask does not exist).

No, actually, they will be either:
 * [null mask, data] if the null mask exists
 * [nullptr, data] either

So you should be able to get the null mask deterministically simply by fetching the first member of the buffers vector.

However, note that the number of buffers for the data itself is type-dependent. Primitive types (e.g. ints, floats...) will use a single buffer, but other types may use more than that.

> [C++] API add value / null mask buffer accessor to ArrayData
> ------------------------------------------------------------
>
>                 Key: ARROW-3478
>                 URL: https://issues.apache.org/jira/browse/ARROW-3478
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Wolf Vollprecht
>            Priority: Minor
>
> Currently, the ArrayData struct has the `std::vector<Buffer> buffers` member.
> The buffers will (from reading the code) either be [null_mask, data] or [data] (if the null mask does not exist).
> I'm not sure if there is an easy way to get the null mask reliably at the moment. If I am understanding correctly, the way to do it right now is to check if the vector has one or two elements, and then use `buffers[0]` as the null mask, and `buffers[1]` as the values.
> I also did not find information regarding this in the spec. So I am not sure if I can rely on this behavior in future versions of the library.
> I am wondering wether adding explicit API for this would make this more reliable. 
>  
> For example two more interface functions
>  * `std::shared_ptr<Buffer> mask()`
>  * `std::shared_ptr<Buffer> values()` 
> Would make it easy for me to rely on the interface to "do the right thing".
>  
> Or am I missing something?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)