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

Method Make

cpp/src/arrow/type.cc:1051–1066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1049}
1050
1051Result<std::shared_ptr<DataType>> MapType::Make(std::shared_ptr<Field> value_field,
1052 bool keys_sorted) {
1053 const auto& value_type = *value_field->type();
1054 if (value_field->nullable() || value_type.id() != Type::STRUCT) {
1055 return Status::TypeError("Map entry field should be non-nullable struct");
1056 }
1057 const auto& struct_type = checked_cast<const StructType&>(value_type);
1058 if (struct_type.num_fields() != 2) {
1059 return Status::TypeError("Map entry field should have two children (got ",
1060 struct_type.num_fields(), ")");
1061 }
1062 if (struct_type.field(0)->nullable()) {
1063 return Status::TypeError("Map key field should be non-nullable");
1064 }
1065 return std::make_shared<MapType>(std::move(value_field), keys_sorted);
1066}
1067
1068std::string MapType::ToString(bool show_metadata) const {
1069 std::stringstream s;

Callers 2

ggandiva_projector_newFunction · 0.45

Calls 8

nullableMethod · 0.80
TypeErrorFunction · 0.70
InvalidFunction · 0.70
MakeFunction · 0.70
typeMethod · 0.45
idMethod · 0.45
num_fieldsMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected