protected void modifyGroupByToOrderBy(boolean setDistinct, ExecutionContext context)
      throws TypeMismatchException, NameResolutionException {
    if (setDistinct) {
      distinct = setDistinct;
    }
    orderByAttrs = new ArrayList<>(groupBy.size());
    int colIndex = 0;
    for (CompiledValue cv : groupBy) {
      CompiledSortCriterion csc = new CompiledSortCriterion(false, cv);
      csc.mapExpressionToProjectionField(projAttrs, context);
      orderByAttrs.add(csc);
    }
    groupBy = null;
  }
Transforms the group by clause into distinct order by clause, if possible
geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledSelect.java