@Override
  public RawReader<OrcStruct> getRawReader(Configuration conf,
                                           boolean collapseEvents,
                                           int bucket,
                                           ValidWriteIdList validWriteIdList,
                                           Path baseDirectory,
                                           Path[] deltaDirectory,
                                           Map<String, Integer> deltasToAttemptId
                                           ) throws IOException {
    boolean isOriginal = false;
    OrcRawRecordMerger.Options mergerOptions = new OrcRawRecordMerger.Options().isCompacting(true)
      .isMajorCompaction(collapseEvents);
    if (baseDirectory != null) {//this is NULL for minor compaction
      //it may also be null if there is no base - only deltas
      mergerOptions.baseDir(baseDirectory);
      if (baseDirectory.getName().startsWith(AcidUtils.BASE_PREFIX)) {
        isOriginal = AcidUtils.MetaDataFile.isRawFormat(baseDirectory, baseDirectory.getFileSystem(conf), null);
        mergerOptions.rootPath(baseDirectory.getParent());
      } else {
        isOriginal = true;
        mergerOptions.rootPath(baseDirectory);
      }
    }
    else {
      //since we have no base, there must be at least 1 delta which must a result of acid write
      //so it must be immediate child of the partition
      mergerOptions.rootPath(deltaDirectory[0].getParent());
    }
    return new OrcRawRecordMerger(conf, collapseEvents, null, isOriginal,
        bucket, validWriteIdList, new Reader.Options(conf), deltaDirectory, mergerOptions, deltasToAttemptId);
  }
@param bucket bucket/writer ID for this split of the compaction job
ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java