@Override
  public void flush() throws HiveException{
    try {
      if (hashAggregations != null) {
        LOG.info("Begin Hash Table flush: size = {}", hashAggregations.size());
        Iterator iter = hashAggregations.entrySet().iterator();
        while (iter.hasNext()) {
          Map.Entry<KeyWrapper, AggregationBuffer[]> m = (Map.Entry) iter
              .next();

          forward(m.getKey().getKeyArray(), m.getValue());
          iter.remove();
        }
        hashAggregations.clear();
      } else if (aggregations != null) {
        // sort-based aggregations
        if (currentKeys != null) {
          forward(currentKeys.getKeyArray(), aggregations);
        }
        currentKeys = null;
      } else {
        // The GroupByOperator is not initialized, which means there is no
        // data
        // (since we initialize the operators when we see the first record).
        // Just do nothing here.
      }
    } catch (Exception e) {
      throw new HiveException(e);
    }
  }
Forward all aggregations to children. It is only used by DemuxOperator.
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java