public void flush() throws HiveException {
    if (!isEnabled || (topN == 0)) return;
    try {
      flushInternal();
    } catch (IOException ex) {
      throw new HiveException(ex);
    }
  }
Flushes all the rows cached in the heap.
ql/src/java/org/apache/hadoop/hive/ql/exec/TopNHash.java