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

Method DeleteMany

cpp/src/arrow/util/key_value_metadata.cc:108–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108Status KeyValueMetadata::DeleteMany(std::vector<int64_t> indices) {
109 std::sort(indices.begin(), indices.end());
110 const int64_t size = static_cast<int64_t>(keys_.size());
111 indices.push_back(size);
112
113 int64_t shift = 0;
114 for (int64_t i = 0; i < static_cast<int64_t>(indices.size() - 1); ++i) {
115 ++shift;
116 const auto start = indices[i] + 1;
117 const auto stop = indices[i + 1];
118 DCHECK_GE(start, 0);
119 DCHECK_LE(start, size);
120 DCHECK_GE(stop, 0);
121 DCHECK_LE(stop, size);
122 for (int64_t index = start; index < stop; ++index) {
123 keys_[index - shift] = std::move(keys_[index]);
124 values_[index - shift] = std::move(values_[index]);
125 }
126 }
127 keys_.resize(size - shift);
128 values_.resize(size - shift);
129 return Status::OK();
130}
131
132Status KeyValueMetadata::Delete(std::string_view key) {
133 auto index = FindKey(key);

Callers 3

DoImportMethod · 0.80
FieldFromFlatbufferFunction · 0.80
TESTFunction · 0.80

Calls 6

push_backMethod · 0.80
resizeMethod · 0.80
OKFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.64