fix is_empty/is_null=False conversion to grpc#1051
Conversation
✅ Deploy Preview for poetic-froyo-8baba7 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
is_empty=False conversion to grpcis_empty/is_null=False conversion to grpc
📝 WalkthroughWalkthroughThe changes update the Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested reviewers
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/conversions/fixtures.py (1)
100-103: Add the newFieldConditionandConditionto the related fixtures lists
field_condition_is_empty_falseand its wrappercondition_field_is_empty_falseare created here but are not referenced in the"FieldCondition"and"Condition"arrays further down (around lines 1577 and 1604).
If downstream parametrised tests rely on those arrays to discover all variants, the new objects will never be exercised.@@ "FieldCondition": [ field_condition_values_count, + field_condition_is_empty_false, ] @@ "Condition": [ condition_values_count, + condition_field_is_empty_false, ]
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
qdrant_client/conversions/conversion.py(1 hunks)tests/conversions/fixtures.py(3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
tests/conversions/fixtures.py (2)
qdrant_client/http/models/models.py (1)
FieldCondition(796-817)qdrant_client/grpc/points_pb2.pyi (4)
FieldCondition(4596-4654)is_empty(4490-4490)Condition(4477-4514)field(4488-4488)
qdrant_client/conversions/conversion.py (2)
qdrant_client/grpc/points_pb2.pyi (11)
match(4611-4612)FieldCondition(4596-4654)Range(4741-4769)DatetimeRange(4773-4805)datetime_range(4629-4630)geo_bounding_box(4617-4618)geo_radius(4620-4621)geo_polygon(4626-4627)values_count(4623-4624)is_empty(4490-4490)is_null(4496-4496)qdrant_client/http/models/models.py (3)
FieldCondition(796-817)Range(2073-2081)DatetimeRange(525-533)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Redirect rules - poetic-froyo-8baba7
- GitHub Check: Header rules - poetic-froyo-8baba7
- GitHub Check: Python 3.13.x on ubuntu-latest test
- GitHub Check: Python 3.12.x on ubuntu-latest test
- GitHub Check: Python 3.10.x on ubuntu-latest test
- GitHub Check: Python 3.9.x on ubuntu-latest test
- GitHub Check: Python 3.11.x on ubuntu-latest test
- GitHub Check: Pages changed - poetic-froyo-8baba7
🔇 Additional comments (2)
tests/conversions/fixtures.py (1)
157-166: Confirm the fixture order—duplicates may affectmin_shouldevaluation
condition_field_is_empty_falseis appended tomin_should.conditionsimmediately after itsTruecounterpart.
Because the conversion code now distinguishesNonevsFalse, having both variants side-by-side makes sense, but double-check any tests that assert positional equality on this list; the insertion can shift indexes and cause brittle assertions.No change requested if the tests are order-agnostic.
qdrant_client/conversions/conversion.py (1)
2797-2830: LGTM! Critical fix for boolean field conversion.This change correctly addresses the core issue described in the PR objectives. The previous truthiness checks (
if model.is_empty) would evaluate toFalsefor bothNone(field not set) andFalse(field explicitly set to false), making it impossible to distinguish between these states during gRPC conversion.By changing to explicit
is not Nonechecks, the code now properly:
- Handles
is_empty=Falseandis_null=Falseas valid, explicitly-set values- Distinguishes between unset fields (
None) and fields explicitly set toFalse- Maintains consistent logic across all optional fields in the method
This ensures correct conversion of
FieldConditionobjects from REST to gRPC format, particularly for boolean fields whereFalseis a meaningful value distinct fromNone.
Conversion to grpc for
is_emptyfield condition was broken because python returnsFalseforNoneand also forFalseinif model.is_empty