private void testDeleteEventFiltering2() throws Exception {
    boolean filterOn =
        HiveConf.getBoolVar(conf, HiveConf.ConfVars.FILTER_DELETE_EVENTS);
    boolean skipKeyIdx =
        HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_TEST_MODE_ACID_KEY_IDX_SKIP);
    int bucket = 1;
    AcidOutputFormat.Options options = new AcidOutputFormat.Options(conf)
        .filesystem(fs)
        .bucket(bucket)
        .writingBase(true)
        .minimumWriteId(10000002)
        .maximumWriteId(10000002)
        .inspector(inspector)
        .reporter(Reporter.NULL)
        .recordIdColumn(1)
        .finalDestination(root);

    int bucketProperty = BucketCodec.V1.encode(options);

    //create data that looks like a compacted base that includes some data
    //from 'original' files and some from native Acid write
    RecordUpdater updater = new OrcRecordUpdater(root, options);
    updater.insert(0, new DummyRow(1, 0, 0, bucket));
    updater.insert(0, new DummyRow(1, 1, 0, bucket));
    updater.insert(0, new DummyRow(2, 2, 0, bucket));
    updater.insert(10000001, new DummyRow(3, 0, 10000001, bucket));
    updater.close(false);

    //delete 3rd row
    options.writingBase(false).minimumWriteId(10000004)
        .maximumWriteId(10000004);
    updater = new OrcRecordUpdater(root, options);
    updater.delete(options.getMinimumWriteId(),
        new DummyRow(-1, 0, 0, bucket));
    //hypothetically this matches something in (nonexistent here)
    // delta_10000003_10000003
    updater.delete(options.getMinimumWriteId(),
        new DummyRow(-1, 5, 10000003, bucket));
    updater.close(false);

    conf.set(ValidTxnList.VALID_TXNS_KEY,
        new ValidReadTxnList(new long[0], new BitSet(), 1000, Long.MAX_VALUE).writeToString());
    //HWM is not important - just make sure deltas created above are read as
    // if committed
    conf.set(ValidWriteIdList.VALID_WRITEIDS_KEY,
        "tbl:10000005:" + Long.MAX_VALUE + "::");

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

    assertEquals(1, splits.size());
    assertEquals(root.toUri().toString() + File.separator +
            "base_10000002/bucket_00001",
        splits.get(0).getPath().toUri().toString());
    assertFalse(splits.get(0).isOriginal());


    VectorizedOrcAcidRowBatchReader vectorizedReader =
        new VectorizedOrcAcidRowBatchReader(splits.get(0), conf, Reporter.NULL,
            new VectorizedRowBatchCtx());
    ColumnizedDeleteEventRegistry deleteEventRegistry =
        (ColumnizedDeleteEventRegistry) vectorizedReader
            .getDeleteEventRegistry();
    assertEquals("number of delete events for stripe 1", filterOn ? 1 : 2,
        deleteEventRegistry.size());
    OrcRawRecordMerger.KeyInterval keyInterval =
        vectorizedReader.getKeyInterval();
    SearchArgument sarg = vectorizedReader.getDeleteEventSarg();
    if(filterOn) {
      if (skipKeyIdx) {
        // If key index is not present, the min max key interval uses stripe stats instead
        assertEquals(new OrcRawRecordMerger.KeyInterval(
                new RecordIdentifier(0, bucketProperty, 0),
                new RecordIdentifier(10000001, bucketProperty, 2)),
            keyInterval);
      } else {
        assertEquals(new OrcRawRecordMerger.KeyInterval(
                new RecordIdentifier(0, bucketProperty, 0),
                new RecordIdentifier(10000001, bucketProperty, 0)),
            keyInterval);
      }
      //key point is that in leaf-5 is (rowId <= 2) even though maxKey has
      //rowId 0.  more in VectorizedOrcAcidRowBatchReader.findMinMaxKeys
      assertEquals( "leaf-0 = (LESS_THAN originalTransaction 0)," +
          " leaf-1 = (LESS_THAN bucket 536936448)," +
          " leaf-2 = (LESS_THAN rowId 0)," +
          " leaf-3 = (LESS_THAN_EQUALS originalTransaction 10000001)," +
          " leaf-4 = (LESS_THAN_EQUALS bucket 536936448)," +
          " leaf-5 = (LESS_THAN_EQUALS rowId 2)," +
          " expr = (and (not leaf-0) (not leaf-1) " +
          "(not leaf-2) leaf-3 leaf-4 leaf-5)",
          ((SearchArgumentImpl) sarg).toOldString());
    }
    else {
      assertEquals(new OrcRawRecordMerger.KeyInterval(null, null), keyInterval);
      assertNull(sarg);
    }

  }
Tests that we can figure out min/max ROW__ID for each split and then use
that to only load delete events between min/max.
This test doesn't actually check what is read - that is done more E2E
unit tests.
@throws Exception
ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestVectorizedOrcAcidRowBatchReader.java