]
Adrian Nistor commented on ISPN-5787:
-------------------------------------
Fixing #2 requires ISPN-5791
Issues with aggregation queries using Date objects
--------------------------------------------------
Key: ISPN-5787
URL:
https://issues.jboss.org/browse/ISPN-5787
Project: Infinispan
Issue Type: Bug
Reporter: Jakub Markos
Assignee: Adrian Nistor
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.