[Backport 2.6] fix: correct parameter name typos in QueryIterator causing partition filter bypass (#3324)#3330
Merged
sre-ci-robot merged 1 commit intomilvus-io:2.6from Mar 23, 2026
Conversation
…filter bypass (milvus-io#3324) ## Summary - Fix typo in `QueryIterator.__seek_to_offset` and `__setup_ts_by_request`: `output_field` → `output_fields`, `partition_name` → `partition_names` - The singular parameter names didn't match `grpc_handler.query()`'s signature, so they fell into `**kwargs` and were silently ignored - This caused the seek phase to scan **all partitions** instead of the target one when both `partition_names` and `offset` are specified, producing an incorrect PK cursor ## Bug Details When `query_iterator` is called with both `partition_names` and `offset`: 1. The seek phase queries all partitions instead of the specified one (because `partition_names=None` on the server side short-circuits the partition filter) 2. The PK cursor is set based on global data, not the target partition's data 3. `next()` correctly filters by partition (it already uses plural names), but the cursor position is wrong 4. The returned row count does not match expectations For example, with `partition_names=["part_b"]` and `offset=50` on a partition with 100 rows (PKs 100–199): - **Before fix**: returns 100 rows (expected 50) - **After fix**: returns 50 rows (correct) ## Changes - `pymilvus/orm/iterator.py`: Fix 4 parameter names (2 in `__seek_to_offset`, 2 in `__setup_ts_by_request`) - `tests/orm/test_iterator.py`: Add `TestQueryIteratorPartitionNamesPassthrough` with 4 tests verifying correct parameter names are passed through to `conn.query()` ## Test plan - [x] New tests fail before the fix (confirmed via TDD red phase) - [x] New tests pass after the fix - [x] Full iterator test suite passes (136/136) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: alohaha22 <shawn.work1229@outlook.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> (cherry picked from commit 4a02330) Signed-off-by: pymilvus-bot <pymilvus-bot@users.noreply.github.com>
3 tasks
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pymilvus-bot, 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 2.6 #3330 +/- ##
=======================================
Coverage 89.93% 89.93%
=======================================
Files 64 64
Lines 13348 13348
=======================================
Hits 12004 12004
Misses 1344 1344 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Manual backport of #3324 to
2.6.