bkietz commented on a change in pull request #8894:
URL: https://github.com/apache/arrow/pull/8894#discussion_r545414598
##########
File path: cpp/src/arrow/array/array_struct_test.cc
##########
@@ -582,4 +583,39 @@ TEST_F(TestStructBuilder, TestSlice) {
ASSERT_EQ(list_field->null_count(), 1);
}
+TEST(TestFieldRef, GetChildren) {
+ auto struct_array = ArrayFromJSON(struct_({field("a", float64())}), R"([
+ {"a": 6.125},
+ {"a": 0.0},
+ {"a": -1}
+ ])");
+
+ ASSERT_OK_AND_ASSIGN(auto a, FieldRef("a").GetOne(*struct_array));
+ auto expected_a = ArrayFromJSON(float64(), "[6.125, 0.0, -1]");
+ AssertArraysEqual(*a, *expected_a);
+
+ auto ToChunked = [struct_array](int64_t midpoint) {
+ return ChunkedArray(
+ ArrayVector{
+ struct_array->Slice(0, midpoint),
+ struct_array->Slice(midpoint),
+ },
+ struct_array->type());
+ };
+ AssertChunkedEquivalent(ToChunked(1), ToChunked(2));
Review comment:
This was just to ensure FieldRef::GetOne functions correctly with
chunked arrays
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]