| 435 | } |
| 436 | |
| 437 | void HashAggregation::resetPartialOutputIfNeed() { |
| 438 | if (!partialFull_) { |
| 439 | return; |
| 440 | } |
| 441 | BOLT_CHECK( |
| 442 | !isGlobal_ && (groupingSet_ == nullptr || !groupingSet_->hasSpilled())); |
| 443 | const double aggregationPct = |
| 444 | numOutputRows_ == 0 ? 0 : (numOutputRows_ * 1.0) / numInputRows_ * 100; |
| 445 | { |
| 446 | auto lockedStats = stats_.wlock(); |
| 447 | lockedStats->addRuntimeStat( |
| 448 | "flushRowCount", RuntimeCounter(numOutputRows_)); |
| 449 | lockedStats->addRuntimeStat("flushTimes", RuntimeCounter(1)); |
| 450 | lockedStats->addRuntimeStat( |
| 451 | "partialAggregationPct", RuntimeCounter(aggregationPct)); |
| 452 | } |
| 453 | |
| 454 | groupingSet_->resetTable(); |
| 455 | partialFull_ = false; |
| 456 | totalInputRows_ += numInputRows_; |
| 457 | if (!finished_) { |
| 458 | maybeIncreasePartialAggregationMemoryUsage(aggregationPct); |
| 459 | } |
| 460 | numOutputRows_ = 0; |
| 461 | numInputRows_ = 0; |
| 462 | } |
| 463 | |
| 464 | void HashAggregation::maybeIncreasePartialAggregationMemoryUsage( |
| 465 | double aggregationPct) { |
nothing calls this directly
no test coverage detected