@Test
  public void testImportPartitionedCreate() throws Exception {
    runStatementOnDriver("drop table if exists T");
    runStatementOnDriver("drop table if exists Tstage");
    //Tstage is just a simple way to generate test data
    runStatementOnDriver("create table Tstage (a int, b int) partitioned by (p int) stored" +
        " as orc");
    int[][] data = {{1, 2, 10}, {3, 4, 11}, {5, 6, 12}};
    //this creates an ORC data file with correct schema under table root
    runStatementOnDriver("insert into Tstage" + TestTxnCommands2.makeValuesClause(data));
    //now we have an archive with 3 partitions
    runStatementOnDriver("export table Tstage to '" + getWarehouseDir() + "/1'");

    /*
     * load partition that doesn't exist in T
     * There is some parallelism going on if you load more than 1 partition which I don't
     * understand. In testImportPartitionedCreate2() that's reasonable since each partition is
     * loaded in parallel.  Why it happens here is beyond me.
     * The file name changes from run to run between 000000_0 and 000001_0 and 000002_0
     * The data is correct but this causes ROW__ID.bucketId/file names to change
     */
    runStatementOnDriver("import table T PARTITION(p=10) from '" + getWarehouseDir() + "/1'");
    runStatementOnDriver("import table T PARTITION(p=11) from '" + getWarehouseDir() + "/1'");
    runStatementOnDriver("import table T PARTITION(p=12) from '" + getWarehouseDir() + "/1'");

    //verify data
    List<String> rs = runStatementOnDriver("select a, b, p from T order by a,b,p");
    Assert.assertEquals("reading imported data",
        TestTxnCommands2.stringifyValues(data), rs);
    //verify that we are indeed doing an Acid write (import)
    rs = runStatementOnDriver("select INPUT__FILE__NAME from T order by INPUT__FILE__NAME");
    Assert.assertEquals(3, rs.size());
    Assert.assertTrue(rs.get(0).contains("t/p=10/delta_0000001_0000001_0000/00000"));
    Assert.assertTrue(rs.get(1).contains("t/p=11/delta_0000002_0000002_0000/00000"));
    Assert.assertTrue(rs.get(2).contains("t/p=12/delta_0000003_0000003_0000/00000"));
  }
test selective partitioned import where target table needs to be created.
export is made from acid table so that target table is created as acid
ql/src/test/org/apache/hadoop/hive/ql/TestTxnExIm.java