public void clear() {
    readCursor = rowsInReadBuffer = rowsOnDisk = 0;
    readBufferUsed = false;

    if (parentDir != null) {
      if (input != null) {
        try {
          input.close();
        } catch (Throwable ignored) {
        }
        input = null;
      }
      if (output != null) {
        try {
          output.close();
        } catch (Throwable ignored) {
        }
        output = null;
      }
      try {
        FileUtil.fullyDelete(parentDir);
      } catch (Throwable ignored) {
      }
      parentDir = null;
      tmpFile = null;
    }
  }
An eager key/value container that puts every row directly to output stream.
Kryo is used for the serialization/deserialization.
When reading, we load IN_MEMORY_NUM_ROWS rows from input stream to memory batch by batch.
ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/KeyValueContainer.java