Hi,

The following code will work:


  auto list = std::static_pointer_cast<arrow::ListArray>(data->chunk(0));
  auto currentSeries = list->value_slice(rowIndex);


Thanks,
--
kou

In <CAB0p=8Dh4CL8vDiBmyP36L8UEd=RiKghGJY=4krtv_hwa27...@mail.gmail.com>
  "Re: get element of ListArray as Array" on Thu, 13 Aug 2020 18:03:30 +0200,
  Kirill Lykov <lykov.kir...@gmail.com> wrote:

> I think I found a way:
> ```
>         // data is arrow:ChunkedArray
>         auto list = 
> std::static_pointer_cast<arrow::ListArray>(data->chunk(0));
>         auto values = list->values();
>         auto startOffset = list->value_offset(rowIndex);
>         auto length = list->value_offset(idx + 1) - startOffset;
>         auto currentSerie = values->Slice(startOffset, length);
> ```
> 
> On Thu, Aug 13, 2020 at 4:54 PM Kirill Lykov <lykov.kir...@gmail.com> wrote:
>>
>> I have a ChunkedArray of type `arrow::list` and I want to take a value
>> for a particular row in this column and return it as Array.
>> From example, I see one way of doing it -- get raw pointer using
>> `values` method and also take `value_offset` to get offset. This way I
>> will get pointers to the whole range.
>> If this is the only way, can I somehow create a zero-copy arrow::Array
>> from this range?
>>
>> --
>> Best regards,
>> Kirill Lykov
> 
> 
> 
> -- 
> Best regards,
> Kirill Lykov

Reply via email to