Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
zhztheplayer committed Dec 13, 2023
1 parent 050df44 commit 01b382f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion velox/exec/HashAggregation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ void HashAggregation::initialize() {

bool HashAggregation::abandonPartialAggregationEarly(int64_t numOutput) const {
VELOX_CHECK(isPartialOutput_ && !isGlobal_);
if (groupingSet_->hasSpilled()) {
// Once spilling kicked in, disable the abandoning code path.
return false;
}
return numInputRows_ > abandonPartialAggregationMinRows_ &&
100 * numOutput / numInputRows_ >= abandonPartialAggregationMinPct_;
}
Expand All @@ -135,9 +139,13 @@ void HashAggregation::addInput(RowVectorPtr input) {
// NOTE: we should not trigger partial output flush in case of global
// aggregation as the final aggregator will handle it the same way as the
// partial aggregator. Hence, we have to use more memory anyway.
//
// We currently disable flushing when spilling is enabled. It's possible
// to make spilling and flushing work together once we had a way to
// count the spilled data size into partial aggregation's memory usage.
const bool abandonPartialEarly = isPartialOutput_ && !isGlobal_ &&
abandonPartialAggregationEarly(groupingSet_->numDistinct());
if (isPartialOutput_ && !isGlobal_ &&
if (!spillConfig_.has_value() && isPartialOutput_ && !isGlobal_ &&
(abandonPartialEarly ||
groupingSet_->isPartialFull(maxPartialAggregationMemoryUsage_))) {
partialFull_ = true;
Expand Down

0 comments on commit 01b382f

Please sign in to comment.