Skip to content

fix: resolve bytes vector type misidentification in search path#3291

Open
zhuwenxing wants to merge 5 commits intomilvus-io:masterfrom
zhuwenxing:fix/bytes-vector-search-type
Open

fix: resolve bytes vector type misidentification in search path#3291
zhuwenxing wants to merge 5 commits intomilvus-io:masterfrom
zhuwenxing:fix/bytes-vector-search-type

Conversation

@zhuwenxing
Copy link
Contributor

Summary

  • When raw bytes are passed as search vectors for float16/bfloat16 fields, _prepare_placeholder_str incorrectly marks them as BinaryVector
  • Fix by looking up the actual vector type from the collection schema and mapping to the correct PlaceholderType

Changes

  • pymilvus/client/prepare.py: Add vector_data_type param to _prepare_placeholder_str, add _get_vector_type_from_schema helper, pass schema-derived type in search_requests_with_expr
  • pymilvus/client/grpc_handler.py: Fetch schema when search data contains bytes in search() and hybrid_search()
  • pymilvus/client/async_grpc_handler.py: Symmetric async modifications
  • tests/prepare/test_search.py: Unit tests for bytes + vector_data_type mapping and schema helper

Test plan

  • Unit tests: pytest tests/prepare/test_search.py (102 passed)
  • E2E: float16 bytes search against Milvus master
  • E2E: binary bytes search regression
  • E2E: float32 search regression

Fixes #3290

@sre-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zhuwenxing
To complete the pull request process, please assign tedxu after the PR has been reviewed.
You can assign the PR to them by writing /assign @tedxu in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.08%. Comparing base (4a02330) to head (1bb83bf).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3291      +/-   ##
==========================================
+ Coverage   90.04%   90.08%   +0.03%     
==========================================
  Files          64       64              
  Lines       13638    13680      +42     
==========================================
+ Hits        12281    12323      +42     
  Misses       1357     1357              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zhuwenxing zhuwenxing force-pushed the fix/bytes-vector-search-type branch 3 times, most recently from 8a8d0fe to a0114e8 Compare February 24, 2026 06:16
@mergify mergify bot added the ci-passed label Feb 24, 2026
@XuanYang-cn
Copy link
Contributor

@zhuwenxing Please fix the conflicts

When raw bytes are passed as search vectors for float16/bfloat16 fields,
_prepare_placeholder_str incorrectly marks them as BinaryVector. Fix by
looking up the actual vector type from the collection schema and mapping
to the correct PlaceholderType.

Fixes milvus-io#3290

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
Cover the new bytes vector type detection logic in GrpcHandler,
AsyncGrpcHandler (search/hybrid_search) and Prepare (schema kwarg
resolution), raising patch coverage above the 90% threshold.

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
@zhuwenxing zhuwenxing force-pushed the fix/bytes-vector-search-type branch from 082ac33 to 64cf079 Compare March 20, 2026 06:07
@mergify mergify bot removed the ci-passed label Mar 20, 2026
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
@mergify mergify bot added the ci-passed label Mar 20, 2026
@zhuwenxing
Copy link
Contributor Author

@XuanYang-cn please review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search path misidentifies raw bytes vectors as BinaryVector for float16/bfloat16 types

3 participants