private void flushHashTable(boolean complete) throws HiveException {
    countAfterReport = 0;

    if (complete) {
      for (Map.Entry<KeyWrapper, AggregationBuffer[]> entry : hashAggregations.entrySet()) {
        forward(entry.getKey().getKeyArray(), entry.getValue());
      }
      hashAggregations = null;
      LOG.info("Hash Table completed flushed");
      return;
    }

    int oldSize = hashAggregations.size();
    int flushSize = (int) (oldSize * hashAggrFlushPercent);
    LOG.trace("Hash Tbl flush: #hash table = {}, flush size = {}", oldSize, flushSize);

    Iterator<Map.Entry<KeyWrapper, AggregationBuffer[]>> iter = hashAggregations
        .entrySet().iterator();
    int numDel = 0;
    while (iter.hasNext()) {
      Map.Entry<KeyWrapper, AggregationBuffer[]> m = iter.next();
      forward(m.getKey().getKeyArray(), m.getValue());
      iter.remove();
      numDel++;
      if (numDel >= flushSize) {
        LOG.trace("Hash Table flushed: new size = {}", hashAggregations.size());
        return;
      }
    }
  }
Flush hash table. This method is used by hash-based aggregations
@param complete
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java