public void closeWriters(boolean abort, List<Path> deleteDeltas) throws HiveException {
      Exception exception = null;
      for (int idx = 0; idx < outWriters.length; idx++) {
        if (outWriters[idx] != null) {
          try {
            outWriters[idx].close(abort);
            updateProgress();
          } catch (IOException e) {
            exception = e;
            LOG.error("Error closing " + outWriters[idx].toString(), e);
            // continue closing others
          }
        }
      }
      for (int i = 0; i < updaters.length; i++) {
        if (updaters[i] != null) {
          SerDeStats stats = updaters[i].getStats();
          // Ignore 0 row files except in case of insert overwrite or delete or update
          if (isDirectInsert
              && (stats.getRowCount() > 0 || isInsertOverwrite || AcidUtils.Operation.DELETE.equals(acidOperation)
                  || AcidUtils.Operation.UPDATE.equals(acidOperation))) {

            OrcRecordUpdater recordUpdater = (OrcRecordUpdater) updaters[i];
            switch (acidOperation) {
            case INSERT:
              outPathsCommitted[i] = recordUpdater.getUpdatedFilePath();
              break;
            case UPDATE:
              // In case of update operation, we need both the deleteFilePath and the updatedFilePath.
              // The updateFilePath will be added to the outPathsCommitted array and the deleteFilePath
              // will be collected in a separate list.
              outPathsCommitted[i] = recordUpdater.getUpdatedFilePath();
              if (deleteDeltas != null) {
                deleteDeltas.add(recordUpdater.getDeleteFilePath());
                LOG.debug("The following path has been added to the deleteDeltas list: "
                    + recordUpdater.getDeleteFilePath().toString());
              }
              break;
            case DELETE:
              // In case of delete operation, the deleteFilePath has to be used, not the updatedFilePath
              outPathsCommitted[i] = recordUpdater.getDeleteFilePath();
              break;
            default:
              break;
            }

            LOG.debug(
                "The following path has been added to the outPathsCommitted array: " + outPathsCommitted[i].toString());
          }
          try {
            updaters[i].close(abort);
          } catch (IOException e) {
            exception = e;
            LOG.error("Error closing " + updaters[i].toString(), e);
            // continue closing others
          }
        }
      }
      // Made an attempt to close all writers.
      if (exception != null) {
        throw new HiveException(exception);
      }
    }
For direct write to final path during ACID insert, we create the delta directories
later when we create the RecordUpdater using AcidOutputFormat.Options
ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java