You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "zenithyr (via GitHub)" <gi...@apache.org> on 2023/07/20 07:53:20 UTC
[GitHub] [arrow] zenithyr commented on issue #36782: [C++] cast arrow::Array to user defined structs
zenithyr commented on issue #36782:
URL: https://github.com/apache/arrow/issues/36782#issuecomment-1643449902
It turns out the `struct_field` function in `arrow::compute` can help.
```cpp
arrow::Datum datum;
arrow::compute::StructFieldOptions options;
ARROW_ASSIGN_OR_RAISE(datum, arrow::compute::CallFunction("struct_field", {col3}, &options));
auto struct_array = datum.array_as<arrow::StructArray>();
auto f0 = struct_array->field(0);
auto& id = static_cast<arrow::Int32Array&>(*f0);
```
Still figuring out how to read the nested list...
--
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