[infinispan-issues] [JBoss JIRA] (ISPN-5787) Issues with aggregation queries using Date objects
Jakub Markos (JIRA)
issues at jboss.org
Wed Sep 23 05:14:00 EDT 2015
Jakub Markos created ISPN-5787:
----------------------------------
Summary: 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.
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 numeric 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