wjones127 commented on a change in pull request #11855: URL: https://github.com/apache/arrow/pull/11855#discussion_r777643434
########## File path: cpp/src/arrow/array/array_list_test.cc ########## @@ -717,6 +717,29 @@ TEST_F(TestMapArray, BuildingStringToInt) { ASSERT_ARRAYS_EQUAL(*actual, expected); } +TEST_F(TestMapArray, BuildingWithFieldNames) { + // Builder should preserve field names in output Array + ASSERT_OK_AND_ASSIGN(auto map_type, + MapType::Make(field("some_entries", + struct_({field("some_key", int16(), false), + field("some_value", int16())}), + false))); + + auto key_builder = std::make_shared<Int16Builder>(); + auto item_builder = std::make_shared<Int16Builder>(); + MapBuilder map_builder(default_memory_pool(), key_builder, item_builder, map_type); + + std::shared_ptr<Array> actual; + ASSERT_OK(map_builder.Append()); + ASSERT_OK(key_builder->AppendValues({0, 1, 2, 3, 4, 5})); + ASSERT_OK(item_builder->AppendValues({1, 1, 2, 3, 5, 8})); + ASSERT_OK(map_builder.AppendNull()); + ASSERT_OK(map_builder.Finish(&actual)); Review comment: Added a simple test. -- 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