MCPcopy Create free account
hub / github.com/apache/arrow / ProcessMap

Method ProcessMap

cpp/src/arrow/c/bridge.cc:1308–1331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1306 }
1307
1308 Status ProcessMap() {
1309 RETURN_NOT_OK(f_parser_.CheckAtEnd());
1310 RETURN_NOT_OK(CheckNumChildren(1));
1311 ARROW_ASSIGN_OR_RAISE(auto field, MakeChildField(0));
1312 const auto& value_type = field->type();
1313 if (value_type->id() != Type::STRUCT) {
1314 return Status::Invalid("Imported map array has unexpected child field type: ",
1315 field->ToString());
1316 }
1317 if (value_type->num_fields() != 2) {
1318 return Status::Invalid("Imported map array has unexpected child field type: ",
1319 field->ToString());
1320 }
1321
1322 bool keys_sorted = (c_struct_->flags & ARROW_FLAG_MAP_KEYS_SORTED);
1323
1324 // Some implementations of Arrow (such as Rust) use a non-standard field name
1325 // for key ("keys") and value ("values") fields. For simplicity, we override
1326 // them on import.
1327 type_ =
1328 std::make_shared<MapType>(value_type->field(0)->WithName("key"),
1329 value_type->field(1)->WithName("value"), keys_sorted);
1330 return Status::OK();
1331 }
1332
1333 Status ProcessFixedSizeList() {
1334 RETURN_NOT_OK(f_parser_.CheckNext(':'));

Callers

nothing calls this directly

Calls 9

CheckAtEndMethod · 0.80
WithNameMethod · 0.80
InvalidFunction · 0.50
OKFunction · 0.50
typeMethod · 0.45
idMethod · 0.45
ToStringMethod · 0.45
num_fieldsMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected