Github user Ben-Zvi commented on a diff in the pull request:
https://github.com/apache/drill/pull/938#discussion_r138494777
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java
---
@@ -1178,20 +1273,38 @@ private void checkGroupAndAggrValues(int
incomingRowIdx) {
hashCode >>>= bitsInMask;
HashTable.PutStatus putStatus = null;
long allocatedBeforeHTput = allocator.getAllocatedMemory();
-
// ==========================================
// Insert the key columns into the hash table
// ==========================================
+ boolean noReserveMem = reserveValueBatchMemory == 0;
try {
+ if ( noReserveMem && canSpill ) { throw new
RetryAfterSpillException();} // proactive spill, skip put()
+
putStatus = htables[currentPartition].put(incomingRowIdx,
htIdxHolder, hashCode);
+
+ } catch (RetryAfterSpillException re) {
--- End diff --
Done.
---