edponce commented on code in PR #13009:
URL: https://github.com/apache/arrow/pull/13009#discussion_r860859259
##########
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:
I would expect iterator tests to have a loop form. For example, you can
iterate through a ChunkedArray and store the values into a `std::vector` and
then make assertions against the vector.
--
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]