Hi,
I would like to run query where arguments are org.joda.time.DateTime on
apache ignite 2.1. Something like:

/DateTime startDate = new DateTime(2000, 1, 1, 10, 42, DateTimeZone.UTC);
DateTime endDate = new DateTime(2005, 12, 30, 10, 42, DateTimeZone.UTC);

SqlQuery<Long, Person> query = new SqlQuery<>(Person.class , "birthDate >= ?
and birthDate <= ?");  
query.setArgs(startDate, endDate);
List result = personCache.query(query).getAll();/

but this always return me 0 records. The personCache has set defined query
filed birthdate as:
/<entry key=" birthDate " value="org.joda.time.DateTime"/>/

The interesting is if I do conversion DateTime to joda LocalDate:
/query.setArgs(startDate. toLocalDate(), endDate. toLocalDate()); /
I get some part of records  but not all which satisfy this condition. All
records I’m getting if I switch to ignite version 1.9. 

I see that this is similar topic:
http://apache-ignite-users.70518.x6.nabble.com/How-to-configure-user-data-type-for-sql-queries-td3867.html
and was fix  https://issues.apache.org/jira/browse/IGNITE-2208 which allows
compare binary objects but I’m not sure if this fix works for condition
where we have <= , >=, < , >.
I don’t see any test in IgniteBinaryObjectQueryArgumentsTest.  I have
checked GridH2ValueCacheObject method compareSecure and I don’t see support
for BinaryObject comparision.  Also looke like was change in
GridCacheSqlQuery and method unmarshall was removed in version 2.0. What can
explain different behavior between version 1.9 and 2.1.

My question is if is possible to do such query: "birthDate >= ? and
birthDate <= ?", where query argument is joda DateTime type?

Regards,
Czeslaw




--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Query-by-java-joda-DateTime-tp15902.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to