Repository navigation
fix(edge-py): keep MatchValue(True) a boolean instead of 1 - #11324
inamdarmihir wants to merge 1 commit into
Conversation
PyValueVariants tried to extract an integer before a boolean. A Python bool is a subclass of int, so True became 1 and False became 0, and a filter on a boolean payload field matched nothing. Try Bool before Integer. Extracting a bool is strict, so a plain int is still taken as an integer. Add an example, run by the existing py-examples job, that asserts the value round-trips and filters match. Fixes qdrant#10846 Authored by Mihir
|
No actionable comments were generated in the recent review.
|
Fixes #10846.
Problem
In
qdrant-edge-py,MatchValue(value=True).valuereturned1, so a filter on a boolean payload field matched nothing.PyValueVariants::extracttriedIntegerbeforeBool. A Pythonboolis a subclass ofint, soTrueextracted as an integer.Change
BoolbeforeIntegerinlib/edge/python/src/types/filter/match.rs. Extracting aboolis strict, so a plainintis still taken as an integer.PyValueintypes/value.rsalready orders its variants this way.examples/match_value_types.py, which the existingpy-examplesjob runs. It asserts thatTrue/Falseround-trip and that string, integer and boolean filters each match.Testing
maturin develop --no-default-features --features abi3and ran the reproduction from the issue:likes == Truereturned 0 points before the change and 1 after.AssertionError) and passes with the fix.cargo fmt --check -p qdrant-edge-pyis clean.cargo clippy -D warningsrun here: it stops on existingunnecessary_as_slicelints inlib/sparse, which this change doesn't touch.AI disclosure
Commits:
Prompt, summarized from the instructions given to the AI tool: fix #10846, where
MatchValue(value=True).valueis1inqdrant-edge-pyand boolean filters match nothing. Find the cause inlib/edge/python/src/types/filter/match.rs, keep the change to that file plus a regression example run by the existingpy-examplesjob, build the bindings with maturin, reproduce the issue first, and confirm the new example fails on the old code.I reviewed the result and can answer questions about it.
Authored by Mihir