private KeyInterval discoverOriginalKeyBounds(Reader reader, int bucket,
                                         Reader.Options options,
                                         Configuration conf, Options mergerOptions) throws IOException {
    long rowLength = 0;
    long rowOffset = 0;
    long offset = options.getOffset();//this would usually be at block boundary
    long maxOffset = options.getMaxOffset();//this would usually be at block boundary
    boolean isTail = true;
    RecordIdentifier minKey = null;
    RecordIdentifier maxKey = null;
    TransactionMetaData tfp = TransactionMetaData.findWriteIDForSynthetcRowIDs(
      mergerOptions.getBucketPath(), mergerOptions.getRootPath(), conf);
    int bucketProperty = encodeBucketId(conf, bucket, tfp.statementId);
   /**
    * options.getOffset() and getMaxOffset() would usually be at block boundary which doesn't
    * necessarily match stripe boundary.  So we want to come up with minKey to be one before the 1st
    * row of the first stripe that starts after getOffset() and maxKey to be the last row of the
    * stripe that contains getMaxOffset().  This breaks if getOffset() and getMaxOffset() are inside
    * the sames tripe - in this case we have minKey & isTail=false but rowLength is never set.
    * (HIVE-16953)
    */
    for(StripeInformation stripe: reader.getStripes()) {
      if (offset > stripe.getOffset()) {
        rowOffset += stripe.getNumberOfRows();
      } else if (maxOffset > stripe.getOffset()) {
        rowLength += stripe.getNumberOfRows();
      } else {
        isTail = false;
        break;
      }
    }
    if (rowOffset > 0) {
      minKey = new RecordIdentifier(tfp.syntheticWriteId, bucketProperty, rowOffset - 1);
    }
    if (!isTail) {
      maxKey = new RecordIdentifier(tfp.syntheticWriteId, bucketProperty, rowOffset + rowLength - 1);
    }
    return new KeyInterval(minKey, maxKey);
  }
Find the key range for original bucket files.
For unbucketed tables the insert event data is still written to bucket_N file except that
N is just a writer ID - it still matches {@link RecordIdentifier#getBucketProperty()}.  For
'original' files (ubucketed) the same applies.  A file 000000_0 encodes a taskId/wirterId and
at read time we synthesize {@link RecordIdentifier#getBucketProperty()} to match the file name
and so the same bucketProperty is used here to create minKey/maxKey, i.e. these keys are valid
to filter data from delete_delta files even for unbucketed tables.
@param reader the reader
@param bucket the bucket number we are reading
@param options the options for reading with
@throws IOException
ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcRawRecordMerger.java