MCPcopy Create free account
hub / github.com/bytedance/bolt / extractForSpill

Method extractForSpill

bolt/exec/SortedAggregations.cpp:187–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187void SortedAggregations::extractForSpill(
188 folly::Range<char**> groups,
189 VectorPtr& result) const {
190 auto* arrayVector = result->as<ArrayVector>();
191 arrayVector->resize(groups.size());
192
193 auto* rawOffsets =
194 arrayVector->mutableOffsets(groups.size())->asMutable<vector_size_t>();
195 auto* rawSizes =
196 arrayVector->mutableSizes(groups.size())->asMutable<vector_size_t>();
197
198 vector_size_t offset = 0;
199 for (auto i = 0; i < groups.size(); ++i) {
200 auto* accumulator = reinterpret_cast<RowPointers*>(groups[i] + offset_);
201 rawSizes[i] = accumulator->size;
202 rawOffsets[i] = offset;
203 offset += accumulator->size;
204 }
205
206 std::vector<char*> groupRows(offset);
207
208 offset = 0;
209 for (auto i = 0; i < groups.size(); ++i) {
210 auto* accumulator = reinterpret_cast<RowPointers*>(groups[i] + offset_);
211 accumulator->read(
212 folly::Range(groupRows.data() + offset, accumulator->size));
213 offset += accumulator->size;
214 }
215
216 auto& elementsVector = arrayVector->elements();
217 elementsVector->resize(offset);
218 inputData_->extractSerializedRows(
219 folly::Range(groupRows.data(), groupRows.size()), elementsVector);
220}
221
222void SortedAggregations::clear() {
223 inputData_->clear();

Callers

nothing calls this directly

Calls 8

mutableOffsetsMethod · 0.80
mutableSizesMethod · 0.80
extractSerializedRowsMethod · 0.80
RangeClass · 0.50
resizeMethod · 0.45
sizeMethod · 0.45
readMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected