| 624 | } |
| 625 | } |
| 626 | |
| 627 | bool GroupingSet::getGlobalAggregationOutput( |
| 628 | RowContainerIterator& iterator, |
| 629 | RowVectorPtr& result) { |
| 630 | if (iterator.allocationIndex != 0) { |
| 631 | return false; |
| 632 | } |
| 633 | |
| 634 | initializeGlobalAggregation(); |
| 635 | |
| 636 | auto groups = lookup_->hits.data(); |
| 637 | for (int32_t i = 0; i < aggregates_.size(); ++i) { |
| 638 | if (!aggregates_[i].sortingKeys.empty()) { |
| 639 | continue; |
| 640 | } |
| 641 | |
| 642 | auto& function = aggregates_[i].function; |
| 643 | if (isPartial_) { |
| 644 | function->extractAccumulators(groups, 1, &result->childAt(i)); |
| 645 | } else { |
| 646 | function->extractValues(groups, 1, &result->childAt(i)); |
| 647 | } |
| 648 | } |
| 649 | |
| 650 | if (sortedAggregations_) { |
| 651 | sortedAggregations_->extractValues(folly::Range(groups, 1), result); |
| 652 | } |
| 653 | |
| 654 | for (const auto& aggregation : distinctAggregations_) { |
| 655 | if (aggregation != nullptr) { |
| 656 | aggregation->extractValues(folly::Range(groups, 1), result); |
| 657 | } |
| 658 | } |
| 659 | |
| 660 | iterator.allocationIndex = std::numeric_limits<int32_t>::max(); |
| 661 | return true; |
| 662 | } |
| 663 | |
| 664 | bool GroupingSet::getDefaultGlobalGroupingSetOutput( |
nothing calls this directly
no test coverage detected