@Test
  public void testDeleteDeltasFiltering() throws Exception {

    int bucket = 0;
    AcidOutputFormat.Options options = new AcidOutputFormat.Options(conf)
            .filesystem(fs)
            .bucket(bucket)
            .writingBase(false)
            .minimumWriteId(1)
            .maximumWriteId(1)
            .inspector(inspector)
            .reporter(Reporter.NULL)
            .recordIdColumn(1)
            .finalDestination(root);

    RecordUpdater updater = new OrcRecordUpdater(root, options);

    // Inserting a new record and then deleting it, 3 times.
    // Every insertion/deletion is in a separate transaction.
    // When reading, this will generate 3 splits, one per insert event.
    for (int i = 1; i <= 5; i = i + 2) {
      // Transaction that inserts one row with value i
      options.minimumWriteId(i)
              .maximumWriteId(i);
      updater = new OrcRecordUpdater(root, options);
      updater.insert(options.getMinimumWriteId(),
              new DummyRow(i, 0, options.getMinimumWriteId(), bucket));
      updater.close(false);

      // Transaction that deletes previously inserted row
      options.minimumWriteId(i+1)
              .maximumWriteId(i+1);
      updater = new OrcRecordUpdater(root, options);
      updater.delete(options.getMinimumWriteId(),
              new DummyRow(-1, 0, i, bucket));
      updater.close(false);
    }

    conf.set(ValidTxnList.VALID_TXNS_KEY,
            new ValidReadTxnList(new long[0], new BitSet(), 1000, Long.MAX_VALUE).writeToString());
    conf.set(ValidWriteIdList.VALID_WRITEIDS_KEY,
            "tbl:6:" + Long.MAX_VALUE + "::");

    List<OrcInputFormat.SplitStrategy<?>> splitStrategies = getSplitStrategies();
    assertEquals(1, splitStrategies.size());
    List<OrcSplit> splits = ((OrcInputFormat.ACIDSplitStrategy)splitStrategies.get(0)).getSplits();

    assertEquals(3, splits.size());

    // Split for transaction #1 should include all 3 delete deltas
    assertEquals(3, splits.get(0).getDeltas().size());
    assertEquals(2, splits.get(0).getDeltas().get(0).getMinWriteId());
    assertEquals(2, splits.get(0).getDeltas().get(0).getMaxWriteId());
    assertEquals(4, splits.get(0).getDeltas().get(1).getMinWriteId());
    assertEquals(4, splits.get(0).getDeltas().get(1).getMaxWriteId());
    assertEquals(6, splits.get(0).getDeltas().get(2).getMinWriteId());
    assertEquals(6, splits.get(0).getDeltas().get(2).getMaxWriteId());

    // Split for transaction #3 should include only 2 deltas with transactions #4 & #6
    assertEquals(2, splits.get(1).getDeltas().size());
    assertEquals(4, splits.get(1).getDeltas().get(0).getMinWriteId());
    assertEquals(4, splits.get(1).getDeltas().get(0).getMaxWriteId());
    assertEquals(6, splits.get(1).getDeltas().get(1).getMinWriteId());
    assertEquals(6, splits.get(1).getDeltas().get(1).getMaxWriteId());

    // Split for transaction #5 should include only 1 deltas with transactions #6
    assertEquals(1, splits.get(2).getDeltas().size());
    assertEquals(6, splits.get(2).getDeltas().get(0).getMinWriteId());
    assertEquals(6, splits.get(2).getDeltas().get(0).getMaxWriteId());
  }
This test checks that a split filters out delete_delta folders which only have transactions that happened
in the past relative to the current split
ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestOrcSplit.java