| 185 | } |
| 186 | |
| 187 | void 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 | |
| 222 | void SortedAggregations::clear() { |
| 223 | inputData_->clear(); |
nothing calls this directly
no test coverage detected