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

Method ProcessMap

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

Source from the content-addressed store, hash-verified

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