[infinispan-issues] [JBoss JIRA] (ISPN-5787) Issues with aggregation queries using Date objects
Adrian Nistor (JIRA)
issues at jboss.org
Mon Jan 4 12:57:01 EST 2016
[ https://issues.jboss.org/browse/ISPN-5787?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Adrian Nistor updated ISPN-5787:
--------------------------------
Git Pull Request: https://github.com/infinispan/infinispan/pull/3739, https://github.com/infinispan/infinispan/pull/3919 (was: https://github.com/infinispan/infinispan/pull/3739)
> Issues with aggregation queries using Date objects
> --------------------------------------------------
>
> Key: ISPN-5787
> URL: https://issues.jboss.org/browse/ISPN-5787
> Project: Infinispan
> Issue Type: Bug
> Affects Versions: 8.0.1.Final, 8.1.0.Alpha1
> Reporter: Jakub Markos
> Assignee: Adrian Nistor
> Fix For: 8.1.0.Alpha2, 8.0.2.Final
>
>
> I found 2 problems, not sure if they have a common cause:
> 1.
> This query
> {code}
> Query q = qf.from(getModelFactory().getTransactionImplClass())
> .select("date")
> .having("date").between(makeDate("2013-02-15"), makeDate("2013-03-15")).toBuilder()
> .groupBy("date")
> .build();
> List<Object[]> list = q.list();
> {code}
> fails with
> {code}
> org.hibernate.hql.ParsingException: HQL000002: The query SELECT _gen0.date FROM org.infinispan.query.dsl.embedded.testdomain.hsearch.TransactionHS _gen0 WHERE (date >= Fri Feb 15 01:00:00 CET 2013) AND (date <= Fri Mar 15 01:00:00 CET 2013) is not valid; Parser error messages: [[statement, statementElement, selectStatement, queryExpression, querySpec, whereClause, logicalExpression, expression, logicalOrExpression, logicalAndExpression, negatedExpression, equalityExpression, relationalExpression, concatenation, additiveExpression, multiplyExpression, unaryExpression, atom]: line 1:116 mismatched token: [@35,116:118='Feb',<75>,1:116]; expecting type RIGHT_PAREN].
> {code}
> The query works after removing the groupBy. It also partially works in remote mode (running in RemoteQueryDslConditionsTest) - the query is parsed, but still doesn't return the result as a Date object.
> 2.
> This query
> {code}
> Query q = qf.from(getModelFactory().getTransactionImplClass())
> .select(Expression.count("date"), Expression.min("date"))
> .having("description").eq("Hotel").toBuilder()
> .groupBy("id")
> .build();
> List<Object[]> list = q.list();
> {code}
> returns in the 2nd column the internal representation of the Date (i.e. 20130227000000000) instead of an object. Selecting only the minimum, select(Expression.min("date")), the query returns a Date object.
> Both queries are supposed to be run inside the QueryDslConditionsTest test class.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the infinispan-issues
mailing list