WillAyd commented on issue #593: URL: https://github.com/apache/arrow-nanoarrow/issues/593#issuecomment-2302628958
Here's some code that I specifically crafted in my last video on nanoarrow: https://github.com/WillAyd/bearly/blob/23f4a84095811047d8a319101c9b437fa11ba349/src/bearly/bearly_ext.cc#L32 Essentially I am going through each stream of a pa.Table, go column-by-column, and then iterate the values within each column. The stream / array value iteration already have C++ iterators, but the column-by-column iteration is a classic loop ```cpp for (const auto &chunk : array_stream) { for (decltype(schema->n_children) i = 0; i < schema->n_children; ++i) { nanoarrow::UniqueArrayView array_view; ArrowArrayViewInitFromSchema(array_view.get(), schema->children[i], &error); NANOARROW_THROW_NOT_OK( ArrowArrayViewSetArray(array_view.get(), chunk.children[i], &error)); for (const auto value : nanoarrow::ViewArrayAs<int64_t>(array_view.get())) { // do something with the values of each array here } } } ``` -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
