@Override
  protected void getSourceForInsert(StringBuilder query) {
    super.getSourceForInsert(query);
    if (StringUtils.isNotBlank(orderByClause)) {
      query.append(orderByClause);
    } else {
      query.append("order by ROW__ID.writeId ASC, ROW__ID.bucketId ASC, ROW__ID.rowId ASC");
    }
    query.append(") t2");
  }
Builds query strings that help with REBALANCE compaction of CRUD.
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactionQueryBuilderForRebalance.java