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

Method DeleteMany

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

Source from the content-addressed store, hash-verified

112}
113
114Status KeyValueMetadata::DeleteMany(std::vector<int64_t> indices) {
115 std::sort(indices.begin(), indices.end());
116 const int64_t size = static_cast<int64_t>(keys_.size());
117 indices.push_back(size);
118
119 int64_t shift = 0;
120 for (int64_t i = 0; i < static_cast<int64_t>(indices.size() - 1); ++i) {
121 ++shift;
122 const auto start = indices[i] + 1;
123 const auto stop = indices[i + 1];
124 DCHECK_GE(start, 0);
125 DCHECK_LE(start, size);
126 DCHECK_GE(stop, 0);
127 DCHECK_LE(stop, size);
128 for (int64_t index = start; index < stop; ++index) {
129 keys_[index - shift] = std::move(keys_[index]);
130 values_[index - shift] = std::move(values_[index]);
131 }
132 }
133 keys_.resize(size - shift);
134 values_.resize(size - shift);
135 return Status::OK();
136}
137
138Status KeyValueMetadata::Delete(std::string_view key) {
139 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