Azure / Azure/azure-cosmosdb-java

Duplicate results when DISTINCT querying

Aperta
#367 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
59
Fork
68
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**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**

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia riproducendo la query DISTINCT tramite il Java async SDK 2.6.11 con maxItemCount impostato su 10, quindi confrontala con 1000 e con il risultato del Portal. Analizza il percorso della query tra partizioni e il comportamento della paginazione; il lavoro è completato quando l’iterazione su tutte le pagine restituisce i 40 valori distinti senza duplicati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
databases
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.