@Test
  public void testInsertOverwriteToAcidWithUnionRemove() throws Exception {
    hiveConf.setBoolVar(HiveConf.ConfVars.HIVE_OPTIMIZE_UNION_REMOVE, true);
    hiveConf.setVar(HiveConf.ConfVars.HIVE_FETCH_TASK_CONVERSION, "none");
    d.close();
    d = new Driver(hiveConf);
    dropTables("T");
    runStatementOnDriver("create table T (a int, b int) stored as ORC  TBLPROPERTIES ('transactional'='true')");

    CommandProcessorException e = runStatementOnDriverNegative(
        "insert overwrite table T select a, b from " + TxnCommandsBaseForTests.Table.ACIDTBL +
            " where a between 1 and 3 group by a, b union all select a, b from " +
            TxnCommandsBaseForTests.Table.ACIDTBL +
            " where a between 5 and 7 union all select a, b from " +
            TxnCommandsBaseForTests.Table.ACIDTBL + " where a >= 9");
    Assert.assertTrue("", e.getMessage().contains("not supported due to OVERWRITE and UNION ALL"));
  }
Insert into unbucketed acid table from union all query
Union All is flattened so nested subdirs are created and acid move drops them since
delta dirs have unique names
ql/src/test/org/apache/hadoop/hive/ql/TestTxnNoBuckets.java