@Override
  void close() {

    if (cache != null && cacheKey != null) {
      cache.release(cacheKey);
    }

    // check if there are IOExceptions
    if (!isAborted()) {
      setAborted(execContext.getIoCxt().getIOExceptions());
    }

    // detecting failed executions by exceptions thrown by the operator tree
    try {
      if (mergeOp == null || mfWork == null) {
        return;
      }
      boolean abort = isAborted();
      mergeOp.close(abort);

      ExecMapper.ReportStats rps = new ExecMapper.ReportStats(reporter, jconf);
      mergeOp.preorderMap(rps);
    } catch (Exception e) {
      if (!isAborted()) {
        // signal new failure to map-reduce
        LOG.error("Hit error while closing operators - failing tree");
        throw new RuntimeException("Hive Runtime Error while closing operators",
            e);
      }
    } finally {
      Utilities.clearWorkMap(jconf);
      MapredContext.close();
    }
  }
Record processor for fast merging of files.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/MergeFileRecordProcessor.java