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/01/29 18:26:09 UTC

[GitHub] [arrow] westonpace commented on issue #9325: [arrow c++]When I read parquet file and get a arrow::Table, how can I convert it to std::vector?

westonpace commented on issue #9325:
URL: https://github.com/apache/arrow/issues/9325#issuecomment-769971724


   @joeyac is on the right track.  A `ListArray` is an array that has an extra list of offsets.  So if you have a `ListArray` of struct then you can think of it conceptually like...
   ```
   [{a: 1}, {a: 2}, {a: 3}, {a: 4}, {a: 5}, {a: 6}] with offsets [0, 2, 4, 6]
   ```
   This represents the two dimensional list...
   ```
   [
     [{a: 1}, {a: 2}],
     [{a: 3}, {a: 4}],
     [{a: 5}, {a: 6}]
   ]
   ```
   The offsets tell you the start and stop of each inner list (e.g. the first list starts at index 0 and stops at index 2).  The function `value_slice` mentioned by @joeyac will give you the nth list as an Array (the type of that array will match the type of the list array so it will be an array of struct).


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

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