Azure / Azure/data-api-builder

[Bug]: GraphQL fails translating filter with "in" predicate (Cosmos DB backend)

Aperta
#3,061 0 commenti 4 reazioni 0 assegnatari Vedi su GitHub
bug cosmos cri known-issue triage
Lingua principale
C#
Stelle
1.5k
Fork
370
Merge medio
3g 22h
PR unite (30g)
9

Descrizione

### What happened?

When querying a Data API Builder (DAB) GraphQL endpoint backed by Azure Cosmos DB (NoSQL), queries that use the in filtering operator fail at runtime, even though the operator is exposed in the GraphQL schema via introspection.

The schema correctly advertises support for the in operator on both IdFilterInput and StringFilterInput. However, any query that attempts to use in results in a runtime error:

Cannot build unknown predicate operation IN.

**Observed behavior**
- This indicates a mismatch between the generated GraphQL schema and the underlying filter translation logic for Cosmos DB.

- in is present in IdFilterInput and StringFilterInput via schema introspection.

- Queries using in fail during execution with a predicate translation error.

- The error occurs regardless of whether in is used on id or string fields.

- Alternative operators such as eq work as expected.

- Large or + eq filters work but scale poorly.

- Multi-lookup via item_by_pk aliases works and avoids the issue.

**Expected behavior**

If the GraphQL schema exposes the in operator for a filter input, queries using it should either:
- Execute successfully against Cosmos DB, or

- Be rejected at schema generation or validation time if unsupported.

**Impact**

This makes it difficult to efficiently query entities by a list of IDs using GraphQL filtering. Consumers are forced to use less performant workarounds (large or expressions or multiple point reads via aliases), even though list membership semantics are exposed in the schema.

**Key question**

Is the in filter operator intended to be supported for Cosmos DB backends in Data API Builder?
If not, should it be excluded from the generated GraphQL schema to avoid confusion?

### Version

v1.6.84

### What database are you using?

CosmosDB NoSQL

### What hosting model are you using?

Container Apps

### Which API approach are you accessing DAB through?

GraphQL

### Relevant log output

```Text

```

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Parti dal percorso di traduzione dei filtri GraphQL per il backend Cosmos DB e riproduci il problema con l’operatore `in` su IdFilterInput e StringFilterInput. Controlla lo schema generato e la gestione dei predicati a runtime; il lavoro è completato quando le query supportate vengono eseguite correttamente oppure gli operatori non supportati vengono omessi o rifiutati in modo coerente, con copertura di regressione.

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

Valutazione

Stack tecnologico
azure, csharp, graphql
Ambito
api, backend-api-design, databases
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.