WillAyd opened a new issue, #701: URL: https://github.com/apache/arrow-nanoarrow/issues/701
Assuming we have the following program: ```cpp #include <iostream> #include <nanoarrow/nanoarrow.hpp> using namespace nanoarrow::literals; int main() { struct ArrowSchema schema; ArrowSchemaInit(&schema); ArrowSchemaSetType(&schema, NANOARROW_TYPE_LARGE_STRING); ArrowArray array1; ArrowArrayInitFromSchema(&array1, &schema, nullptr); ArrowArrayStartAppending(&array1); ArrowArrayAppendString(&array1, "foo"_asv); ArrowArrayAppendString(&array1, "bar"_asv); ArrowArrayFinishBuildingDefault(&array1, nullptr); ArrowArray array2; ArrowArrayInitFromSchema(&array2, &schema, nullptr); ArrowArrayStartAppending(&array2); ArrowArrayAppendString(&array2, "hopefully this does not show"_asv); ArrowArrayAppendString(&array2, "this should not show either"_asv); ArrowArrayAppendString(&array2, "this is a new string"_asv); ArrowArrayAppendString(&array2, "this is a newer string"_asv); ArrowArrayFinishBuildingDefault(&array2, nullptr); array2.offset = 2; struct ArrowArrayStream array_stream; ArrowBasicArrayStreamInit(&array_stream, &schema, 2); ArrowBasicArrayStreamSetArray(&array_stream, 0, &array1); ArrowBasicArrayStreamSetArray(&array_stream, 1, &array2); std::cout << "Here are my results with ViewArrayAsBytes" << std::endl; nanoarrow::ViewArrayStream array_stream_view(&array_stream); for (const auto &array : array_stream_view) { for (const auto val : nanoarrow::ViewArrayAsBytes<64>(&array)) { std::cout << std::string_view{(*val).data, static_cast<size_t>((*val).size_bytes)} << std::endl; } } /* std::cout << "Here is with standard ArrowArrayView usage" << std::endl; nanoarrow::ViewArrayStream array_stream_view(&array_stream); nanoarrow::UniqueSchema array_stream_schema{}; array_stream.get_schema(&array_stream, array_stream_schema.get()); nanoarrow::UniqueArrayView array_view{}; for (const auto &array : array_stream_view) { NANOARROW_THROW_NOT_OK( ArrowArrayViewInitFromSchema(array_view.get(), array_stream_schema.get(), nullptr)); NANOARROW_THROW_NOT_OK( ArrowArrayViewSetArray(array_view.get(), &array, nullptr)); for (int64_t i = 0; i < array_view->length - array_view->offset; i++) { const auto sv = ArrowArrayViewGetStringUnsafe(array_view.get(), i); std::cout << std::string_view{sv.data, static_cast<size_t>(sv.size_bytes)} << std::endl; } array_view.reset(); } */ return 0; } ``` It seems like the `ViewArrayAsBytes` construct may be ignoring the offset altogether, as it prints out: ``` Here are my results with ViewArrayAsBytes foo bar hopefully this does not show this should not show either this is a new string this is a newer string ``` If I were to uncomment that out and use the latter implementation that loops from ` i = 0; i < array_view->length - array_view->offset` then I get the correct result. Is this an issue with the `ViewArrayAsBytes` implementation or am I misunderstanding how the offset is supposed to work? -- 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-unsubscr...@arrow.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org