You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/07/23 12:32:54 UTC

[GitHub] [arrow] lidavidm commented on issue #10788: How to read a boolean column in C++

lidavidm commented on issue #10788:
URL: https://github.com/apache/arrow/issues/10788#issuecomment-885606033


   In all cases, you may prefer to downcast to the concrete Array subclass and use accessor methods. In this case that would be Int64Array, StringArray, and [BooleanArray](https://github.com/apache/arrow/blob/3f592a0a24432d3eee9f66081714e7cf4f9928f5/cpp/src/arrow/array/array_primitive.h#L76). BooleanArray has a Value() method that gets the value at a particular index, and of course all arrays have IsValid/IsNull methods.
   
   Indeed, the encoding of a Boolean array is one boolean per bit. You can see this in the definition of `BooleanArray::Value` above. You'll have to take into account the offset as well in case the array is a slice. (Hence the zeroth value in an array lies at the `offset + 0`th bit.)


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