Azure / Azure/azure-cosmosdb-java
Duplicate results when DISTINCT querying
- Dominant language
- Java
- Stars
- 59
- Forks
- 68
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
DISTINCT query via the 2.6.11 Java async SDK is returning duplicate results.
**To Reproduce**
Via the 2.6.11 Java async SDK I am querying documents with query which looks like
```SELECT DISTINCT o.nest1.nest2.field as id FROM Objects o```
with
```
FeedOptions queryOptions = new FeedOptions();
queryOptions.setMaxItemCount(10);
queryOptions.setEnableCrossPartitionQuery(true);
```
The database has ~750 entries with 40 distinct values of this key. However after iterating all results from the pages I get, there are 69 of them, containing some duplicate ids.
When I run the same query via the Portal UI, I get the expected 40 results.
When I change the setMaxItemCount to 1000, I get the expected 40 results.
Not sure whether it's relevant, but the database uses this field `o.nest1.nest2.field` as partition key.
**Expected behavior**
DISTINCT query should not return repeated entries.
**Actual behavior**
Repeated entries are seen (69 entries for 40 distinct values).
**Environment summary**
SDK Version: 2.6.11 (first seen on 2.6.3, update did not help)
Java JDK version: 1.8.0_15 (same seen on JDK 11)
OS Version: seen both on MacOS and Linux.
**Additional context**
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.