private int estimateSize(AggregationBuffer agg, List<Field> fields) {
    int length = 0;
    for (Field f : fields) {
      try {
        Object o = f.get(agg);
        if (o instanceof String){
          length += ((String)o).length();
        }
        else if (o instanceof ByteArrayRef){
          length += ((ByteArrayRef)o).getData().length;
        }
      } catch (Exception e) {
        // continue.. null out the field?
      }
    }
    return length;
  }
Based on user-parameters, should the hash table be flushed.

@param newKeys
         keys for the row under consideration
ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java