Skip to content

[C++] Map type ignores key/item/value field names #49415

@kou

Description

@kou

Describe the bug, including details regarding any error messages, version, and platform.

I'm preparing an integration test for pure Ruby Apache Arrow reader/writer and found this.

In our integration test, we have an integration test that uses some_key/some_item/some_entries as key/item/value field names:

MapField('map_other_names',
get_field('some_key', 'utf8', nullable=False),
get_field('some_value', 'int32'),
entries_name='some_entries'),

The C++ implementation rewrites key/item/value field names as key/value/entries:

*out = std::make_shared<MapType>(children[0]->type()->field(0)->WithName("key"),
children[0]->type()->field(1)->WithName("value"),

arrow/cpp/src/arrow/type.cc

Lines 1042 to 1043 in 007903c

::arrow::field("entries",
struct_({std::move(key_field), std::move(item_field)}), false),

So the expected value represented in JSON uses some_key/some_item/some_entries but the generated Apache Arrow data by the C++ implementation uses key/item/entries.

FYI: The above WithName() code was added by #35297.

Component(s)

C++

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions