Repository navigation
Python: Keep null fields in negated Azure Cosmos DB eq filters - #8771
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits intoSep 28, 2026
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
Conversation
ni (nniiovoo)
temporarily deployed
to
github-app-auth
September 25, 2026 18:57 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused translation change correctly handles Cosmos three-valued logic and is adequately covered by unit and integration tests.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes Cosmos DB negated equality filters so records with null fields match portable connector semantics.
Changes:
- Adds an explicit null guard to equality predicates.
- Updates SQL translation tests and adds null-field regression coverage.
- Verifies behavior against live Cosmos DB integration tests.
| File | Description |
|---|---|
python/packages/azure-cosmos/agent_framework_azure_cosmos/_vector_store.py |
Adds null-safe equality translation. |
python/packages/azure-cosmos/tests/azure_cosmos/test_vector_store.py |
Updates SQL expectations and regression coverage. |
python/packages/azure-cosmos/tests/azure_cosmos/test_vector_store_integration.py |
Verifies negated equality includes null records. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Contributor
Author
|
@microsoft-github-policy-service agree |
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
github-app-auth
September 28, 2026 11:55 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Sep 28, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
NOTover aneqfilter onCosmosCollectionleaves out records whose field isnull, whileInMemoryCollectionand the other connectors include them. This affects bothget(filter=...)andsearch(filter=...).eqwas translated to(IS_DEFINED(x) AND x = @p). In Cosmos SQL,null = @pisundefined,true AND undefinedisundefined, andNOT undefinedstaysundefined, so those items aren't returned. Details and repro in the linked issue.Description & Review Guide
eqis now translated to(IS_DEFINED(x) AND NOT IS_NULL(x) AND x = @p). That's the same guard thein/not_inand ordered operators already use, and matches what the SQL Server connector does foreq. The three exact-SQL test expectations are updated. There's a new NOT-over-eqcase on the nullableoptionalfield, and an assertion in the live integration test.NOT, null rows are now returned, matching the portable semantics. Top-leveleqresults are unchanged:FilterrejectseqwithNone, so null rows never matched before either.eqbranch in_translate_filter. The unit tests pin the generated SQL. Only the opt-in live test (AZURE_COSMOS_VECTOR_TESTS=1, not run in CI) checks returned rows, and I couldn't run it without a Cosmos account. The new assertion runs before themissingrecord is inserted, so the expected set is{one, three}.Related Issue
Fixes #8770
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.