fix(local): skip bool payload values in order_by to match server semantics - #1416
Conversation
✅ Deploy Preview for poetic-froyo-8baba7 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe local order-by conversion retains the boolean guard that excludes boolean payloads from ordering values. The congruence tests add mixed boolean and integer payloads, create an integer index, verify point storage, and compare scroll results across gRPC, HTTP, and local clients. Estimated code review effort: 2 (Simple) | ~10 minutes Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change skips boolean payloads during local order-by conversion, preventing the reported scrolling failure. Mixed-value cross-client coverage is supplied, so the change is ready to merge with normal checks. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation The regression test addresses issue
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Fixes #1415
All Submissions:
devbranch (branched fromdev@7ae6202)order_by bool/to_order_valuein title+body, open+closed - only order_by treats a naive datetime object as local time, but a naive datetime string as UTC #1342/fix(order_by): read a naive datetime as UTC, not local time #1345/fix: treat a naive datetime as UTC in order_by #1352 naive-datetime, a different hunk in the same function, no bool overlap; my only other in-flight here is fix(local): skip bool group-by keys to match server GroupId semantics #1414 grouping)Changes to Core Features:
Root Cause
to_order_value(qdrant_client/local/order_by.py) filters withisinstance(value, (int, float)). In Pythonboolsubclassesint, soTrue/Falsepass the filter and are stored as the record'sorder_valuein_scroll_by_value. ButRecord.order_valueisOrderValue = StrictInt | StrictFloat, which rejects bools at validation - so any bool point on the sort key crashes the whole local scroll with a pydantic ValidationError (pre-fix proof below), instead of being skipped.The server can never produce a bool ordering value:
OrderValue::try_from(Value)(qdrant/lib/segment/src/data_types/order_by.rs) only acceptsas_i64()/as_f64()(bothNoneforBoolper serde_json docs), and both order-by read paths (lib/segment/src/segment/read_view/order_by.rs:filtered_read_by_index_ordered/filtered_read_by_value_stream) read exclusively fromnumeric_index_for(&order_by.key)- bool payloads live in the bool index and yield zero ordering values. Same root cause as #1259 (filters), #1389 (facet), #1413/#1414 (grouping); this is the lastisinstance(..., (int, ...))site in local mode that admits bools.Fix
Bool guard at the top of
to_order_value, mirroring thecheck_rangeconvention inpayload_filters.py:Bool points then carry no ordering value and are skipped.
start_fromneeds no change: it arrives through the validatedStartFrom = StrictInt | StrictFloat | datetime | datemodel, which already rejects bools; only raw payload values bypass validation.Test
qdrant_client/local/tests/test_order_by.py(unit:to_order_value(True/False)isNone, int/float/None unchanged; end-to-end: mixed bool/int scroll asc skips bools[(4, 0), (2, 1)], desc[(2, 1), (4, 0)])7ae6202): 3 failed - unit assertion plus both scroll tests crashing withValidationError: Input should be a valid integer [input_value=True, input_type=bool]qdrant_client/local/tests/83 passed;tests/test_in_memory.py4 passedruff format --check --line-length=99clean on both files (repo-pinned 0.4.3 config; checked with system ruff 0.16.6)Diff scope
2 files, +66/-0 (core 1 file, +6/-0 incl. comments; test 1 file, +60/-0)
Not PR-related failures
None encountered; no server-backed suites run (pure-local change).