@Override
    public int compareTo(RecordIdentifier other) {
      int sup = compareToInternal(other);
      if (sup == 0) {
        if (other.getClass() == ReaderKey.class) {
          ReaderKey oth = (ReaderKey) other;
          if (currentWriteId != oth.currentWriteId) {
            return currentWriteId < oth.currentWriteId ? +1 : -1;
          }
          if(isDeleteEvent != oth.isDeleteEvent) {
            //this is to break a tie if insert + delete of a given row is done within the same
            //txn (so that currentWriteId is the same for both events) and we want the
            //delete event to sort 1st since it needs to be sent up so that
            // OrcInputFormat.getReader(InputSplit inputSplit, Options options) can skip it.
            return isDeleteEvent ? -1 : +1;
          }
        } else {
          return -1;
        }
      }
      return sup;
    }
A RecordIdentifier extended with the current write id. This is the
key of our merge sort with the originalWriteId, bucket, and rowId
ascending and the currentWriteId, statementId descending. This means that if the
reader is collapsing events to just the last update, just the first
instance of each record is required.
ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcRawRecordMerger.java