-
Bug
-
Resolution: Done
-
Major
-
8.1.0.Final, 8.0.2.Final
-
None
This should not be allowed.
public void testGroupingAndAggregationOnSameField() { QueryFactory qf = getQueryFactory(); Query q = qf.from(getModelFactory().getUserImplClass()) .select(Expression.count("surname"), Expression.sum("addresses.number")) .groupBy("surname") .build(); List<Object[]> list = q.list(); // throws ClassCastException }
java.lang.ClassCastException: java.lang.String cannot be cast to org.infinispan.objectfilter.impl.aggregation.Counter at org.infinispan.objectfilter.impl.aggregation.CountAccumulator.merge(CountAccumulator.java:24) at org.infinispan.objectfilter.impl.aggregation.FieldAccumulator.merge(FieldAccumulator.java:42) at org.infinispan.objectfilter.impl.aggregation.Grouper.addRow(Grouper.java:133) at org.infinispan.query.dsl.embedded.impl.AggregatingQuery.getBaseIterator(AggregatingQuery.java:52) at org.infinispan.query.dsl.embedded.impl.HybridQuery$1.<init>(HybridQuery.java:47) at org.infinispan.query.dsl.embedded.impl.HybridQuery.getIterator(HybridQuery.java:45) at org.infinispan.query.dsl.embedded.impl.BaseEmbeddedQuery.listInternal(BaseEmbeddedQuery.java:65) at org.infinispan.query.dsl.embedded.impl.BaseEmbeddedQuery.list(BaseEmbeddedQuery.java:57) at org.infinispan.query.dsl.embedded.impl.DelegatingQuery.list(DelegatingQuery.java:45) at org.infinispan.query.dsl.embedded.QueryDslConditionsTest.testEmbeddedSum(QueryDslConditionsTest.java:1959)