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

Function CreateNameToIndexMap

cpp/src/arrow/type.cc:1333–1343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1331namespace {
1332
1333std::unordered_multimap<std::string_view, int> CreateNameToIndexMap(
1334 const FieldVector& fields) {
1335 std::unordered_multimap<std::string_view, int> name_to_index;
1336 name_to_index.reserve(fields.size());
1337 for (size_t i = 0; i < fields.size(); ++i) {
1338 const std::string_view name = fields[i]->name();
1339 // The find() hint avoids libc++'s quadratic scan of equal keys on plain emplace.
1340 name_to_index.emplace_hint(name_to_index.find(name), name, static_cast<int>(i));
1341 }
1342 return name_to_index;
1343}
1344
1345template <int NotFoundValue = -1, int DuplicateFoundValue = -1>
1346int LookupNameIndex(const std::unordered_multimap<std::string_view, int>& name_to_index,

Callers 3

ImplMethod · 0.85
ImplMethod · 0.85
ImplMethod · 0.85

Calls 4

reserveMethod · 0.45
sizeMethod · 0.45
nameMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected