wgtmac opened a new issue, #35297:
URL: https://github.com/apache/arrow/issues/35297
### Describe the bug, including details regarding any error messages,
version, and platform.
The code below does not deal with field metadata like `nullable` and
`metadata` of key and item sub-fields of map type.
```cpp
Status ConcreteTypeFromFlatbuffer(flatbuf::Type type, const void* type_data,
FieldVector children,
std::shared_ptr<DataType>* out) {
switch (type) {
case flatbuf::Type::NONE:
return Status::Invalid("Type metadata cannot be none");
...
case flatbuf::Type::Map:
if (children.size() != 1) {
return Status::Invalid("Map must have exactly 1 child field");
}
if (children[0]->nullable() || children[0]->type()->id() !=
Type::STRUCT ||
children[0]->type()->num_fields() != 2) {
return Status::Invalid("Map's key-item pairs must be non-nullable
structs");
}
if (children[0]->type()->field(0)->nullable()) {
return Status::Invalid("Map's keys must be non-nullable");
} else {
auto map = static_cast<const flatbuf::Map*>(type_data);
*out =
std::make_shared<MapType>(children[0]->type()->field(0)->type(),
children[0]->type()->field(1)->type(),
map->keysSorted());
}
return Status::OK();
...
default:
return Status::Invalid("Unrecognized type: " +
ToChars(static_cast<int>(type)));
}
}
```
The issue can be easily reproduced by a roundtrip test of schema
serialization with a non-null map item field.
### Component(s)
C++
--
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]