lidavidm commented on code in PR #13009: URL: https://github.com/apache/arrow/pull/13009#discussion_r860912317
########## cpp/src/arrow/stl_iterator_test.cc: ########## @@ -248,5 +248,216 @@ TEST(ArrayIterator, StdMerge) { ASSERT_EQ(values, expected); } +TEST(ChunkedArrayIterator, Basics) { + auto chunk0 = ArrayFromJSON(int32(), "[4, 5, null]"); + auto chunk1 = ArrayFromJSON(int32(), "[6]"); + + ASSERT_OK_AND_ASSIGN(auto result, ChunkedArray::Make({chunk0, chunk1}, int32())); + auto it = Iterate<Int32Type>(*result); + optional<int32_t> v = *it; + ASSERT_EQ(v, 4); + ASSERT_EQ(it[0], 4); + ++it; + ASSERT_EQ(it[0], 5); + ASSERT_EQ(*it, 5); + ASSERT_EQ(it[1], nullopt); + ASSERT_EQ(it[2], 6); Review Comment: Ah I see now, https://en.cppreference.com/w/cpp/iterator/random_access_iterator includes "array notation with subscripting" (I was scanning the code snippets not the text). -- 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 For queries about this service, please contact Infrastructure at: us...@infra.apache.org