]
Work on ISPN-6760 started by Adrian Nistor.
-------------------------------------------
Comparing a sum of an attribute fails with ClassCastException
-------------------------------------------------------------
Key: ISPN-6760
URL:
https://issues.jboss.org/browse/ISPN-6760
Project: Infinispan
Issue Type: Bug
Components: Embedded Querying
Affects Versions: 9.0.0.Alpha2
Reporter: Jakub Markos
Assignee: Adrian Nistor
Fix For: 9.0.0.Alpha3, 9.0.0.Final
The following query (in the context of QueryDslConditionsTest)
{code}
public void testSum2() throws Exception {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getUserImplClass())
.select(sum("age"))
.groupBy("name")
.having(sum("age")).gt(50000).toBuilder()
.build();
List<Object[]> list = q.list();
}
{code}
fails with
{code}
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
at java.lang.Integer.compareTo(Integer.java:52)
at org.infinispan.objectfilter.impl.util.Interval.contains(Interval.java:92)
at
org.infinispan.objectfilter.impl.predicateindex.IntervalCondition.match(IntervalCondition.java:19)
at
org.infinispan.objectfilter.impl.predicateindex.IntervalCondition.match(IntervalCondition.java:9)
at org.infinispan.objectfilter.impl.predicateindex.Predicate.match(Predicate.java:37)
at
org.infinispan.objectfilter.impl.predicateindex.Predicates.notifyMatchingSubscribers(Predicates.java:118)
at
org.infinispan.objectfilter.impl.predicateindex.AttributeNode.processValue(AttributeNode.java:114)
at
org.infinispan.objectfilter.impl.predicateindex.RowMatcherEvalContext.processAttributes(RowMatcherEvalContext.java:30)
at
org.infinispan.objectfilter.impl.predicateindex.MatcherEvalContext.process(MatcherEvalContext.java:129)
at org.infinispan.objectfilter.impl.ObjectFilterImpl.filter(ObjectFilterImpl.java:213)
at org.infinispan.query.dsl.embedded.impl.HybridQuery$1.updateNext(HybridQuery.java:80)
at org.infinispan.query.dsl.embedded.impl.HybridQuery$1.hasNext(HybridQuery.java:59)
at
org.infinispan.query.dsl.embedded.impl.BaseEmbeddedQuery.listInternal(BaseEmbeddedQuery.java:66)
at
org.infinispan.query.dsl.embedded.impl.BaseEmbeddedQuery.list(BaseEmbeddedQuery.java:57)
at org.infinispan.query.dsl.embedded.impl.DelegatingQuery.list(DelegatingQuery.java:49)
at
org.infinispan.query.dsl.embedded.QueryDslConditionsTest.testSum2(QueryDslConditionsTest.java:2001)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:38)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:382)
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
{code}
Using {code}.having(sum("age")).gt(new Long(50000)).toBuilder(){code}
doesn't have any effect.