Fix is_legal_ids() to accept negative int64 primary keys#3273
Conversation
|
Welcome @gonzfe05! It looks like this is your first PR to milvus-io/pymilvus 🎉 |
…s-io#3272 Signed-off-by: fernando <fernandogonzalez512@hotmail.com>
114d6ce to
335a333
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3273 +/- ##
==========================================
+ Coverage 76.36% 76.55% +0.18%
==========================================
Files 63 63
Lines 13321 13322 +1
==========================================
+ Hits 10173 10199 +26
+ Misses 3148 3123 -25 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@gonzfe05 Please fix the code to pass code checker |
Signed-off-by: fernando <fernandogonzalez512@hotmail.com>
Signed-off-by: fernando <fernandogonzalez512@hotmail.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gonzfe05, XuanYang-cn The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
## Summary
- Fix `is_legal_ids()` in `check.py` to accept the full signed int64
range `[-2^63, 2^63-1]` instead of rejecting `value < 0`
- Add tests for `is_legal_ids()` covering negative values, boundary
values, and invalid inputs
## Problem
INT64 primary keys span the full signed range, but `is_legal_ids()`
rejects negative values (lines 133, 145 of `check.py`):
```python
if value < 0 or value > sys.maxsize:
return False
```
This causes `search(ids=...)`, `get()`, and `query(ids=...)` to raise
`ParamError` for valid negative int64 PKs. The Milvus server handles
them correctly only the client-side validation is wrong.
Fixes #3272
## Test plan
- [x] New `TestIsLegalIds` test class with parametrized cases for
valid/invalid IDs
- [x] All 36 tests in `test_check.py` pass
---------
Signed-off-by: fernando <fernandogonzalez512@hotmail.com>
(cherry picked from commit fe02c07)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
✅ Backport Created (cc @XuanYang-cn) |
Summary
is_legal_ids()incheck.pyto accept the full signed int64 range[-2^63, 2^63-1]instead of rejectingvalue < 0is_legal_ids()covering negative values, boundary values, and invalid inputsProblem
INT64 primary keys span the full signed range, but
is_legal_ids()rejects negative values (lines 133, 145 ofcheck.py):This causes
search(ids=...),get(), andquery(ids=...)to raiseParamErrorfor valid negative int64 PKs. The Milvus server handles them correctly only the client-side validation is wrong.Fixes #3272
Test plan
TestIsLegalIdstest class with parametrized cases for valid/invalid IDstest_check.pypass