private String buildAlterTableQuery(String tableName, AcidDirectory dir,
      ValidWriteIdList validWriteIdList, boolean isDeleteDelta) {
    return new CompactionQueryBuilderFactory().getCompactionQueryBuilder(
        CompactionType.MINOR, false)
        .setOperation(CompactionQueryBuilder.Operation.ALTER)
        .setResultTableName(tableName)
        .setDir(dir)
        .setValidWriteIdList(validWriteIdList)
        .setIsDeleteDelta(isDeleteDelta)
        .build();
  }
Builds an alter table query, which adds partitions pointing to location of delta directories.
@param tableName name of the to be altered table
@param dir the parent directory of delta directories
@param validWriteIdList list of valid write IDs
@param isDeleteDelta if true, only the delete delta directories will be mapped as new partitions, otherwise only
                     the delta directories
@return alter table statement
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/MinorQueryCompactor.java