Github user chunhui-shi commented on a diff in the pull request:
https://github.com/apache/drill/pull/1066#discussion_r161607926
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java
---
@@ -1303,6 +1305,8 @@ private void checkGroupAndAggrValues(int
incomingRowIdx) {
long memDiff = allocator.getAllocatedMemory() - allocatedBeforeHTput;
if ( memDiff > 0 ) { logger.warn("Leak: HashTable put() OOM left
behind {} bytes allocated",memDiff); }
+ checkForSpillPossibility(currentPartition);
--- End diff --
Not sure this check 'chooseAPartitionToFlush' is needed. If an exception
is desired, I would think modifying doSpill() is better way e.g. modifying this
line: " if ( victimPartition < 0 ) { return; } " Otherwise in this process
chooseAPartitionToFlush will be called twice.
int victimPartition = chooseAPartitionToFlush(currentPartition,
forceSpill);
// In case no partition has more than one batch -- try and "push the
limits"; maybe next
// time the spill could work.
if ( victimPartition < 0 ) { return; }
---