Skip to content

Commit f2b4e34

Browse files
authored
GH-49456: [C++] Use static key/item/value field names for map type again (#49457)
### Rationale for this change This reverts GH-49415 because the previous behavior (using static "key"/"value"/"entries" field names for map type) is better. Our specification defines the static field names. ### What changes are included in this PR? Always use "key"/"value"/"entries" for map type field names. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. This just revers the unreleased change. * GitHub Issue: #49456 Authored-by: Sutou Kouhei <kou@clear-code.com> Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
1 parent 8e625d0 commit f2b4e34

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

cpp/src/arrow/ipc/metadata_internal.cc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,20 @@ Status ConcreteTypeFromFlatbuffer(flatbuf::Type type, const void* type_data,
390390
return Status::Invalid("Map's keys must be non-nullable");
391391
} else {
392392
auto map = static_cast<const flatbuf::Map*>(type_data);
393-
*out = std::make_shared<MapType>(children[0], map->keysSorted());
393+
// We always use "key"/"value"/"entries" field names instead
394+
// of field names in FlatBuffers because the specification
395+
// defines them:
396+
//
397+
// https://github.com/apache/arrow/blob/apache-arrow-23.0.1/format/Schema.fbs#L127-L130
398+
//
399+
// In a field with Map type, the field has a child Struct
400+
// field, which then has two children: the key type and the
401+
// value type. The names of the child fields may be
402+
// respectively "entries", "key", and "value", but this is
403+
// not enforced.
404+
*out = std::make_shared<MapType>(children[0]->type()->field(0)->WithName("key"),
405+
children[0]->type()->field(1)->WithName("value"),
406+
map->keysSorted());
394407
}
395408
return Status::OK();
396409
case flatbuf::Type::Type_FixedSizeList:

0 commit comments

Comments
 (0)