diff --git a/velox/common/memory/tests/MockSharedArbitratorTest.cpp b/velox/common/memory/tests/MockSharedArbitratorTest.cpp index 077aa20f8e05..492e3b4a3249 100644 --- a/velox/common/memory/tests/MockSharedArbitratorTest.cpp +++ b/velox/common/memory/tests/MockSharedArbitratorTest.cpp @@ -1327,7 +1327,6 @@ DEBUG_ONLY_TEST_F( MockSharedArbitrationTest, freeUnusedCapacityWhenReclaimMemoryPool) { const int allocationSize = kMemoryCapacity / 4; - const int reclaimedMemoryCapacity = kMemoryCapacity; std::shared_ptr reclaimedQuery = addQuery(kMemoryCapacity); MockMemoryOperator* reclaimedQueryOp = addMemoryOp(reclaimedQuery); // The buffer to free later. diff --git a/velox/exec/HashAggregation.cpp b/velox/exec/HashAggregation.cpp index f5c878308b5e..4513f3573df2 100644 --- a/velox/exec/HashAggregation.cpp +++ b/velox/exec/HashAggregation.cpp @@ -162,6 +162,7 @@ HashAggregation::HashAggregation( } bool HashAggregation::abandonPartialAggregationEarly(int64_t numOutput) const { + VELOX_CHECK(isPartialOutput_ && !isGlobal_); return numInputRows_ > abandonPartialAggregationMinRows_ && 100 * numOutput / numInputRows_ >= abandonPartialAggregationMinPct_; } @@ -194,7 +195,7 @@ 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. - const bool abandonPartialEarly = + const bool abandonPartialEarly = isPartialOutput_ && !isGlobal_ && abandonPartialAggregationEarly(groupingSet_->numDistinct()); if (isPartialOutput_ && !isGlobal_ && (abandonPartialEarly ||