public ImmutableQuery addGroupBy(Iterable<Expression> groupBy) {
    return ImmutableQuery.builder().from(this).addAllGroupBy(groupBy).build();
  }
Check if current query has any aggregation calls
criteria/common/src/org/immutables/criteria/expression/Query.java