@Test
  public void testAddPartitionDeltas() throws Exception {

    runStatementOnDriver("drop table if exists " + acidTblPartMsck);

    // Insert few rows
    runStatementOnDriver("insert into " + Table.ACIDTBLPART + " partition(p) values(1,1,'p1'),(2,2,'p1'),(3,3,'p1')");
    runStatementOnDriver("insert into " + Table.ACIDTBLPART + " partition(p) values(1,2,'p1'),(2,3,'p1'),(3,4,'p1')");

    List<String> r = runStatementOnDriver("select a, b from " + Table.ACIDTBLPART + " where p='p1' order by a, b");
    int[][] expected = { { 1, 1 }, { 1, 2 }, { 2, 2 }, { 2, 3 }, { 3, 3 }, { 3, 4 } };
    Assert.assertEquals(stringifyValues(expected), r);
    // Create target table

    runStatementOnDriver("create table " + acidTblPartMsck
        + " (a int, b int) partitioned by (p string) clustered by (a) into 2 buckets"
        + " stored as orc TBLPROPERTIES ('transactional'='true')");

    // copy files on fs
    FileSystem fs = FileSystem.get(hiveConf);
    FileUtil.copy(fs, new Path(getWarehouseDir() + "/" + Table.ACIDTBLPART.toString().toLowerCase() + "/p=p1"), fs,
        new Path(getWarehouseDir(), acidTblPartMsck), false, hiveConf);

    FileStatus[] fileStatuses = fs.listStatus(new Path(getWarehouseDir(), acidTblPartMsck + "/p=p1"));
    Assert.assertEquals(2, fileStatuses.length);
    // call msk repair
    runStatementOnDriver("msck repair table " + acidTblPartMsck);

    r = runStatementOnDriver("select a, b from " + acidTblPartMsck + " where p='p1' order by a, b");
    Assert.assertEquals(stringifyValues(expected), r);

    runStatementOnDriver("drop table if exists " + acidTblPartMsck);
  }
A new partition copied under a table containing only deltas.
@throws Exception ex
ql/src/test/org/apache/hadoop/hive/ql/metadata/TestMSCKRepairOnAcid.java