private String buildCreateTableQuery(Table table, String newTableName, boolean isPartitioned,
      boolean isBucketed, String location) {
    return new CompactionQueryBuilderFactory().getCompactionQueryBuilder(
        CompactionType.MINOR, false)
        .setOperation(CompactionQueryBuilder.Operation.CREATE)
        .setResultTableName(newTableName)
        .setSourceTab(table)
        .setBucketed(isBucketed)
        .setPartitioned(isPartitioned)
        .setLocation(location)
        .build();
  }
Helper method, which builds a create table query. The create query is customized based on the input arguments, but
the schema of the table is the same as an ORC ACID file schema.
@param table he source table, where the compaction is running on
@param newTableName name of the table to be created
@param isPartitioned true, if new table should be partitioned
@param isBucketed true, if the new table should be bucketed
@param location location of the table, can be null
@return a create table statement, always non-null. Example:
<p>
  if source table schema is: (a:int, b:int)
</p>
the corresponding create statement is:
<p>
  CREATE TEMPORARY EXTERNAL TABLE tmp_table (`operation` int, `originalTransaction` bigint, `bucket` int,
  `rowId` bigint, `currentTransaction` bigint, `row` struct<`a` :int, `b` :int> PARTITIONED BY (`file_name` string)
  STORED AS ORC TBLPROPERTIES ('transactional'='false','queryminorcomp'='true');
</p>
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/MinorQueryCompactor.java