Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-6076

Errors when the same column is both a gouping column and an aggregation column

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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)
      

              anistor Adrian Nistor (Inactive)
              anistor Adrian Nistor (Inactive)
              Archiver:
              rhn-support-adongare Amol Dongare

                Created:
                Updated:
                Resolved:
                Archived: