Azure / Azure/data-api-builder

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

Offen
#3,061 0 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug cosmos cri known-issue triage
Vorherrschende Sprache
C#
Sterne
1.5k
Forks
370
Ø Merge
3 T. 22 Std.
Gemergte PRs (30 T.)
9

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne beim GraphQL-Filterübersetzungspfad für das Cosmos DB-Backend und reproduziere den Fehler mit dem `in`-Operator bei IdFilterInput und StringFilterInput. Prüfe das generierte Schema und die Verarbeitung von Prädikaten zur Laufzeit; als abgeschlossen gilt die Arbeit, wenn unterstützte Abfragen korrekt ausgeführt werden oder nicht unterstützte Operatoren konsistent weggelassen oder abgelehnt werden, mit Regressionstests.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
azure, csharp, graphql
Bereich
api, backend-api-design, databases
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.