private String buildCompactionQuery(String sourceTableName, String resultTableName, Table table,
      ValidWriteIdList validWriteIdList) {
    return new CompactionQueryBuilderFactory().getCompactionQueryBuilder(
        CompactionType.MINOR, false)
        .setOperation(CompactionQueryBuilder.Operation.INSERT)
        .setResultTableName(resultTableName)
        .setSourceTabForInsert(sourceTableName)
        .setSourceTab(table)
        .setValidWriteIdList(validWriteIdList)
        .build();
  }
Build a minor compaction query. A compaction query selects the content of the source temporary table and inserts
it into the result table, filtering out all rows which belong to open/aborted transactions.
@param sourceTableName the name of the source table
@param resultTableName the name of the result table
@param table the table to compact
@param validWriteIdList list of valid write IDs
@return compaction query, always non-null
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/MinorQueryCompactor.java