@Override
  public void close() throws StreamingIOFailure {
    if(heapMemoryMonitor != null) {
      heapMemoryMonitor.close();
    }
    boolean haveError = false;
    String partition = null;
    if (LOG.isDebugEnabled()) {
      logStats("Stats before close:");
    }
    for (Map.Entry<String, List<RecordUpdater>> entry : updaters.entrySet()) {
      partition = entry.getKey();
      if (LOG.isDebugEnabled()) {
        LOG.debug("Closing updater for partitions: {}", partition);
      }
      for (RecordUpdater updater : entry.getValue()) {
        if (updater != null) {
          try {
            //try not to leave any files open
            updater.close(false);
          } catch (Exception ex) {
            haveError = true;
            LOG.error("Unable to close " + updater + " due to: " + ex.getMessage(), ex);
          }
        }
      }
      entry.getValue().clear();
    }
    updaters.clear();
    updatedPartitions.clear();
    if (LOG.isDebugEnabled()) {
      logStats("Stats after close:");
    }
    try {
      if(this.fs != null) {
        this.fs.close();
      }
    } catch (IOException e) {
      throw new StreamingIOFailure("Error while closing FileSystem", e);
    }
    if (haveError) {
      throw new StreamingIOFailure("Encountered errors while closing (see logs) " + getWatermark(partition));
    }
  }
Encode a record as an Object that Hive can read with the ObjectInspector associated with the
serde returned by {@link #createSerde}.  This is public so that test frameworks can use it.

@param record record to be deserialized
@return deserialized record as an Object
@throws SerializationError - any error during serialization or deserialization of record
streaming/src/java/org/apache/hive/streaming/AbstractRecordWriter.java