NEW: FetchCountDistinct - query can return distinct values with their counts (#1300)

* NEW: FetchCountDistinct - query can return distinct values with their counts

* Have to disable asserts, because of #1298
This commit is contained in:
Roland Praml
2018-03-02 11:46:41 +13:00
committed by Rob Bygrave
parent 021d57f4b2
commit c1b022c123
11 changed files with 329 additions and 83 deletions
@@ -1,5 +1,6 @@
package io.ebeaninternal.server.querydefn;
import io.ebean.CountDistinctOrder;
import io.ebean.OrderBy;
import io.ebean.Query;
import io.ebeaninternal.api.BindParams;
@@ -23,7 +24,7 @@ class OrmQueryPlanKey implements CQueryPlanKey {
OrmQueryPlanKey(String discValue, TableJoin m2mIncludeTable, SpiQuery.Type type, OrmQueryDetail detail, int maxRows, int firstRow, boolean disableLazyLoading,
OrderBy<?> orderBy, boolean distinct, boolean sqlDistinct, String mapKey, Object id, BindParams bindParams,
SpiExpression whereExpressions, SpiExpression havingExpressions, SpiQuery.TemporalMode temporalMode,
Query.ForUpdate forUpdate, String rootTableAlias, SpiRawSql rawSql, OrmUpdateProperties updateProperties) {
Query.ForUpdate forUpdate, String rootTableAlias, SpiRawSql rawSql, OrmUpdateProperties updateProperties, CountDistinctOrder countDistinctOrder) {
StringBuilder sb = new StringBuilder(300);
if (type != null) {
@@ -62,6 +63,9 @@ class OrmQueryPlanKey implements CQueryPlanKey {
if (mapKey != null) {
sb.append(",mapKey:").append(mapKey);
}
if (countDistinctOrder != null) {
sb.append(",countdistinctoder:").append(countDistinctOrder.name());
}
this.maxRows = maxRows;
this.firstRow = firstRow;
this.rawSqlKey = (rawSql == null) ? null : rawSql.getKey();