Repository navigation
Python: Compare float operands with int fields in Cosmos filters - #10183
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit intoNov 9, 2026
Conversation
Signed-off-by: NNIIOVO <haimingni44@gmail.com>
ni (nniiovoo)
temporarily deployed
to
github-app-auth
November 9, 2026 06:37 — with
GitHub Actions
Inactive
ni (nniiovoo)
temporarily deployed
to
github-app-auth
November 9, 2026 06:37 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the numeric-filter compatibility change.
No open issues 🎉
What changed in this PR
Fixes #10182 by allowing float operands when filtering integer fields in the Python Cosmos vector store, aligning numeric comparisons with existing membership-filter behavior.
Changes:
- Accepts integer and float operands for both numeric field types while continuing to reject booleans.
- Adds translation tests for
eq,ne, andgtwith float operands on integer fields. - Adds integration assertions for
eqandnewith2.0; live Cosmos validation remains unverified.
| File | Description |
|---|---|
python/packages/azure-cosmos/tests/azure_cosmos/test_vector_store.py |
Adds regression coverage for numeric filter translation. |
python/packages/azure-cosmos/tests/azure_cosmos/test_vector_store_integration.py |
Adds result assertions for float equality and inequality on integer fields. |
python/packages/azure-cosmos/agent_framework_azure_cosmos/_vector_store.py |
Unifies numeric operand compatibility for integer and float fields. |
Review effort: Balanced
2 tasks done
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Nov 9, 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
Filtering a Cosmos
intfield with a float like2.0gives wrong results:eqcompiles tofalse, andnecompiles toIS_DEFINED(...), sone 2.0also returns the rows where count is 2. Repro is in #10182.Description & Review Guide
_filter_value_compatiblenow acceptsintandfloatoperands for bothintandfloatfields. Before, onlyfloatfields accepted both. Bools are still rejected on numeric fields.eq/newith a float on anintfield now compile to a normal comparison, likein/not_inalready do. Cosmos stores numbers as doubles, so2 = 2.0is true there.intfield (e.g.gt 1.5) now work instead of raising a TypeError.InMemoryCollectionaccepts those too, but I can limit the change toeq/neif you prefer.Tests: I added
eq/ne/gtcases with float values to the filter translation test (they fail on main), andeq/ne2.0 checks to the Cosmos integration test. I couldn't run the integration test myself because it needs a Cosmos account.Related Issue
Fixes #10182
AI Assistance
AI assistance details: issue analysis, implementation, tests, and this description.
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.