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

Method ProcessMap

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

Source from the content-addressed store, hash-verified

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