| 1319 | } |
| 1320 | } |
| 1321 | } |
| 1322 | |
| 1323 | for (auto& aggregate : aggregates_) { |
| 1324 | BOLT_CHECK(aggregate.sortingKeys.empty()); |
| 1325 | aggregate.function->initializeNewGroups( |
| 1326 | groups.data(), |
| 1327 | folly::Range<const vector_size_t*>( |
| 1328 | groupIndicesOfRows_.data() + initGroupCount, |
| 1329 | groups.size() - initGroupCount)); |
| 1330 | } |
| 1331 | } |
| 1332 | initGroupCount = distinctRows.size(); |
| 1333 | } |
| 1334 | } |
| 1335 | |
| 1336 | void GroupingSet::copyKeyAndUpdateGroups( |
| 1337 | std::vector<char*>& rows, |
| 1338 | std::vector<char*>& groupOfRows, |
| 1339 | std::vector<char*>& distinctRows, |
| 1340 | std::vector<char*>& groups, |
| 1341 | size_t& initGroupCount, |
| 1342 | const RowContainer* container, |
| 1343 | const RowVectorPtr& result, |
| 1344 | const vector_size_t resultOffset) { |
| 1345 | if (rows.empty()) { |
| 1346 | return; |
| 1347 | } |
| 1348 | BOLT_CHECK_EQ(rows.size(), groupOfRows.size()); |
| 1349 | copyKeyAndInitGroup( |
| 1350 | distinctRows, groups, initGroupCount, container, result, resultOffset); |
| 1351 | NanosecondTimer aggTimer(&stats_.aggOutputUpdateTimeNs); |
| 1352 | // calculate rows into groupOfRows |
| 1353 | SelectivityVector selections(groupOfRows.size()); |
| 1354 | auto& accumulators = container->accumulators(); |
| 1355 | BOLT_CHECK_EQ(accumulators.size(), aggregates_.size()); |
| 1356 | for (auto i = 0; i < aggregates_.size(); ++i) { |
nothing calls this directly
no test coverage detected