@Override
  public void close(boolean abort) throws IOException {
    if (abort) {
      if (flushLengths == null) {
        LOG.debug("Close on abort for path: {}.. Deleting..", path);
        fs.delete(path, false);
      }
    } else if (!writerClosed) {
      if (acidOperationalProperties.isSplitUpdate()) {
        // When split-update is enabled, we can choose not to write
        // any delta files when there are no inserts. In such cases only the delete_deltas
        // would be written & they are closed separately below.
        if (indexBuilder.acidStats.inserts > 0) {
          if (writer != null) {
            LOG.debug("Closing writer for path: {} acid stats: {}", path, indexBuilder.acidStats);
            writer.close(); // normal close, when there are inserts.
          }
        } else {
          if (options.isWritingBase()) {
            // With insert overwrite we need the empty file to delete the previous content of the table
            LOG.debug("Empty file has been created for overwrite: {}", path);
            OrcFile.createWriter(path, writerOptions).close();
          } else {
            LOG.debug("No insert events in path: {}.. Deleting..", path);
            fs.delete(path, false);
          }
        }
      } else {
        //so that we create empty bucket files when needed (but see HIVE-17138)
        LOG.debug("Initializing writer before close (to create empty buckets) for path: {}", path);
        initWriter();
        writer.close(); // normal close.
      }
      if (deleteEventWriter != null) {
        if (deleteEventIndexBuilder.acidStats.deletes > 0) {
          LOG.debug("Closing delete event writer for path: {} acid stats: {}", path, indexBuilder.acidStats);
          // Only need to write out & close the delete_delta if there have been any.
          deleteEventWriter.close();
        } else {
          LOG.debug("No delete events in path: {}.. Deleting..", path);
          // Just remove delete_delta, if there have been no delete events.
          fs.delete(deleteEventPath, false);
        }
      }
    }
    if (flushLengths != null) {
      LOG.debug("Closing and deleting flush length file for path: {}", path);
      flushLengths.close();
      fs.delete(OrcAcidUtils.getSideFile(path), false);
    }
    writer = null;
    deleteEventWriter = null;
    writerClosed = true;
  }
make sure bucketProperty in the delete event is from the {@link row} rather than whatever
{@link this#bucket} is.  For bucketed tables, the 2 must agree on bucketId encoded in it
not for necessarily the whole value.  For unbucketed tables there is no relationship.
ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcRecordUpdater.java