@Override
  protected void buildSelectClauseForInsert(StringBuilder query) {
    switch (compactionType) {
    case MAJOR: {
      if (sourcePartition != null) { //mmmajor and partitioned
        if (sourceTab != null) {
          List<FieldSchema> cols = sourceTab.getSd().getCols();
          appendColumns(query, cols, false);
          // If the source table is null, just skip to add this part to the query
        }
      } else { // mmmajor and unpartitioned
        query.append("*");
      }
      break;
    }
    case MINOR: {
      if (sourceTab != null) {
        List<FieldSchema> cols = sourceTab.getSd().getCols();
        appendColumns(query, cols, false);
        // If the source table is null, just skip to add this part to the query
      }
    }
    }
  }
Construct a CompactionQueryBuilderForInsertOnly with required params.

@param compactionType major or minor or rebalance, e.g. CompactionType.MAJOR.
                      Cannot be null.
                      Rebalance compaction is not supported for insert-only tables.
@throws IllegalArgumentException if compactionType is null or the compaction type is REBALANCE
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactionQueryBuilderForInsertOnly.java