@Test
  public void addPartitionBucketed() throws Exception {
    runStatementOnDriver("drop table if exists T");
    runStatementOnDriver("drop table if exists Tstage");
    runStatementOnDriver("create table T (a int, b int) partitioned by (p int) " +
        "clustered by (a) into 2 buckets stored as orc tblproperties('transactional'='true')");
    runStatementOnDriver("create table Tstage (a int, b int)  clustered by (a) into 2 " +
        "buckets stored as orc tblproperties('transactional'='false')");

    runStatementOnDriver("insert into Tstage values(0,2),(1,4)");
    runStatementOnDriver("export table Tstage to '" + getWarehouseDir() + "/1'");

    runStatementOnDriver("ALTER TABLE T ADD PARTITION (p=0) location '"
        + getWarehouseDir() + "/1/data'");

    List<String> rs = runStatementOnDriver(
        "select ROW__ID, p, a, b, INPUT__FILE__NAME from T order by p, ROW__ID");
    String[][] expected = new String[][]{
        {"{\"writeid\":1,\"bucketid\":536936448,\"rowid\":0}\t0\t0\t2",
            "warehouse/t/p=0/delta_0000001_0000001_0000/000001_0"},
        {"{\"writeid\":1,\"bucketid\":536936448,\"rowid\":1}\t0\t1\t4",
            "warehouse/t/p=0/delta_0000001_0000001_0000/000001_0"}};
    checkExpected(rs, expected, "add partition (p=0)");
  }
Micro managed table test
Tests adding multiple partitions
adding partition w/o location
adding partition when it already exists
adding partition when it already exists with "if not exists"
ql/src/test/org/apache/hadoop/hive/ql/TestTxnAddPartition.java