My datastore contains following structure
| id | date | property |
|:-------------------------------------|--------------:|:---------: |
| 78c94c24-8895-11e7-bb31-be2e44b06b34 | 1503556140000 | 9184675510 |
| 78c94c24-8895-11e7-bb31-be2e44b06b34 | 1503469740000 | 9184675510 |
| 78c94c24-8895-11e7-bb31-be2e44b06b34 | 1504074540000 | 9184675510 |
| 7bbb1056-8896-11e7-bb31-be2e44b06b34 | 1503556140000 | 9184675510 |
| 836ea8a8-8896-11e7-bb31-be2e44b06b34 | 1498804140000 | 9184675510 |
| 836ea8a8-8896-11e7-bb31-be2e44b06b34 | 1501396140000 | 9184675510 |
I am trying to filter distinct ids with respect to 'property' from datastore and ordering by date using following JDO query
String queryString = SELECT DISTINCT id FROM com.test.pkg.jdo.TestJDO WHERE property == '9184675510' ORDER BY date DESC
Query query = persistenceManager
.newQuery( queryString );
query.setRange(0,10);
List<String> response = query.execute();
I have set the range to 10 to fetch 10 distinct ids, but the query response returns ids less than 10 even though the datastore contains more records for this filter.
Is it possible that the query scans only 10 records and returns distinct ids among that considering the range been set to that. Is there any other way to accomplish this query perhaps using low level API ?
Any thoughts would be helpful.