protected void runHCatDynamicPartitionedTable(boolean asSingleMapTask,
      String customDynamicPathPattern) throws Exception {
    generateWriteRecords(NUM_RECORDS, NUM_TOP_PARTITIONS, 0);
    HashMap<String, String> properties = new HashMap<String, String>();
    if (customDynamicPathPattern != null) {
      properties.put(HCatConstants.HCAT_DYNAMIC_CUSTOM_PATTERN, customDynamicPathPattern);
    }
    runMRCreate(null, dataColumns, writeRecords.subList(0,NUM_RECORDS/2), NUM_RECORDS/2,
        true, asSingleMapTask, properties);
    runMRCreate(null, dataColumns, writeRecords.subList(NUM_RECORDS/2,NUM_RECORDS), NUM_RECORDS/2,
        true, asSingleMapTask, properties);

    runMRRead(NUM_RECORDS);

    //Read with partition filter
    runMRRead(4, "p1 = \"0\"");
    runMRRead(8, "p1 = \"1\" or p1 = \"3\"");
    runMRRead(4, "p1 = \"4\"");

    // read from hive to test

    String query = "select * from " + tableName;
    driver.run(query);

    ArrayList<String> res = new ArrayList<String>();
    driver.getResults(res);
    assertEquals(NUM_RECORDS, res.size());


    //Test for duplicate publish
    IOException exc = null;
    try {
      generateWriteRecords(NUM_RECORDS, NUM_TOP_PARTITIONS, 0);
      Job job = runMRCreate(null, dataColumns, writeRecords, NUM_RECORDS, false,
          true, properties);

      if (HCatUtil.isHadoop23()) {
        Assert.assertTrue(job.isSuccessful()==false);
      }
    } catch (IOException e) {
      exc = e;
    }

    if (!HCatUtil.isHadoop23()) {
      assertTrue(exc != null);
      assertTrue(exc instanceof HCatException);
      assertTrue("Got exception of type [" + ((HCatException) exc).getErrorType().toString()
          + "] Expected ERROR_PUBLISHING_PARTITION or ERROR_MOVE_FAILED "
          + "or ERROR_DUPLICATE_PARTITION",
          (ErrorType.ERROR_PUBLISHING_PARTITION == ((HCatException) exc).getErrorType())
              || (ErrorType.ERROR_MOVE_FAILED == ((HCatException) exc).getErrorType())
              || (ErrorType.ERROR_DUPLICATE_PARTITION == ((HCatException) exc).getErrorType())
      );
    }

    query = "show partitions " + tableName;
    driver.run(query);
    res = new ArrayList<String>();
    driver.getResults(res);
    assertEquals(NUM_TOP_PARTITIONS*2, res.size());

    query = "select * from " + tableName;
    driver.run(query);
    res = new ArrayList<String>();
    driver.getResults(res);
    assertEquals(NUM_RECORDS, res.size());

    query = "select count(*) from " + tableName;
    driver.run(query);
    res = new ArrayList<String>();
    driver.getResults(res);
    assertEquals(1, res.size());
    assertEquals("20", res.get(0));

    query = "select count(*) from " + tableName + " where p1=1";
    driver.run(query);
    res = new ArrayList<String>();
    driver.getResults(res);
    assertEquals(1, res.size());
    assertEquals("4", res.get(0));
  }
Run the dynamic partitioning test but with multiple map task. See HCATALOG-490
@throws Exception
hcatalog/core/src/test/java/org/apache/hive/hcatalog/mapreduce/TestHCatDynamicPartitioned.java