@Test
  public void testRecordReaderDelta() throws Exception {
    final int BUCKET = 0;
    Configuration conf = new Configuration();
    OrcOutputFormat of = new OrcOutputFormat();
    FileSystem fs = FileSystem.getLocal(conf);
    Path root = new Path(tmpDir, "testRecordReaderDelta").makeQualified(fs);
    fs.delete(root, true);
    ObjectInspector inspector;
    synchronized (TestOrcFile.class) {
      inspector = ObjectInspectorFactory.getReflectionObjectInspector
          (MyRow.class, ObjectInspectorFactory.ObjectInspectorOptions.JAVA);
    }

    // write a delta
    AcidOutputFormat.Options options =
        new AcidOutputFormat.Options(conf)
            .bucket(BUCKET).inspector(inspector).filesystem(fs)
            .writingBase(false).minimumWriteId(1).maximumWriteId(1)
          .finalDestination(root);
    RecordUpdater ru = of.getRecordUpdater(root, options);
    String[][] values = {new String[]{"a", "b", "c", "d", "e"}, new String[]{"f", "g", "h", "i", "j"}};
    for(int i=0; i < values[0].length; ++i) {
      ru.insert(1, new MyRow(values[0][i]));
    }
    ru.close(false);

    // write a delta
    options.minimumWriteId(2).maximumWriteId(2);
    ru = of.getRecordUpdater(root, options);
    for(int i=0; i < values[1].length; ++i) {
      ru.insert(2, new MyRow(values[1][i]));
    }
    ru.close(false);

    InputFormat inf = new OrcInputFormat();
    JobConf job = new JobConf();
    job.set(ValidTxnList.VALID_TXNS_KEY,
        new ValidReadTxnList(new long[0], new BitSet(), 1000, Long.MAX_VALUE).writeToString());
    job.set("mapred.min.split.size", "1");
    job.set("mapred.max.split.size", "2");
    job.set("mapred.input.dir", root.toString());
    job.set("bucket_count", "1");
    job.set(IOConstants.SCHEMA_EVOLUTION_COLUMNS, MyRow.getColumnNamesProperty());
    job.set(IOConstants.SCHEMA_EVOLUTION_COLUMNS_TYPES, MyRow.getColumnTypesProperty());
    AcidUtils.setAcidOperationalProperties(job, true, null);

    job.setBoolean(hive_metastoreConstants.TABLE_IS_TRANSACTIONAL, true);
    InputSplit[] splits = inf.getSplits(job, 5);
    assertEquals(2, splits.length);
    org.apache.hadoop.mapred.RecordReader<NullWritable, OrcStruct> rr;
    for(int j = 0; j < splits.length; j++) {
      InputSplit split = splits[j];
      rr = inf.getRecordReader(split, job, Reporter.NULL);
      OrcStruct row = rr.createValue();
      for (int i = 0; i < values[j].length; ++i) {
        System.out.println("Checking " + i);
        String msg = "split[" + j + "] at i=" + i;
        assertTrue(msg, rr.next(NullWritable.get(), row));
        assertEquals(msg, values[j][i], row.getFieldValue(0).toString());
      }
      assertFalse(rr.next(NullWritable.get(), row));
    }
  }
Test the RecordReader when there is a new base and a delta.
@throws Exception
ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestOrcRawRecordMerger.java