Bug 1333297 - Errors when the same column is both a gouping column and an aggregation column
Summary: Errors when the same column is both a gouping column and an aggregation column
Keywords:
Status: POST
Alias: None
Product: JBoss Data Grid 6
Classification: JBoss
Component: Infinispan
Version: 6.6.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: ---
Assignee: Tristan Tarrant
QA Contact: Martin Gencur
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-05 08:52 UTC by Adrian Nistor
Modified: 2022-03-03 21:26 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker ISPN-6076 0 Major Resolved Errors when the same column is both a gouping column and an aggregation column 2017-05-17 19:23:12 UTC

Description Adrian Nistor 2016-05-05 08:52:05 UTC
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)


Note You need to log in before you can comment on or make changes to this bug.