pymilvus
pymilvus copied to clipboard
[Bug]: [milvus_client] Get interface returns empty when "ids" is a list of string for string primary key
Is there an existing issue for this?
- [X] I have searched the existing issues
Describe the bug
Get interface returns empty when "ids" is a list of string for string primary key
[2024-04-26 15:51:44 - DEBUG - ci_test]: (api_request) : [MilvusClient.get] args: ['milvus_client_api_query_TIafVN0a', ['0'], None], kwargs: {'timeout': 120} (api_request.py:62)
[2024-04-26 15:51:44 - DEBUG - ci_test]: (api_response) : [] (api_request.py:37)
Expected Behavior
Return filtered entities successfully
Steps/Code To Reproduce behavior
@pytest.mark.tags(CaseLabel.L1)
def test_milvus_client_get_normal_string(self):
"""
target: test get interface for string field
method: create connection, collection, insert delete, and search
expected: search/query successfully without deleted data
"""
client = self._connect(enable_milvus_client_api=True)
collection_name = cf.gen_unique_str(prefix)
# 1. create collection
client_w.create_collection(client, collection_name, default_dim, id_type="string", max_length=ct.default_length)
# 2. insert
rng = np.random.default_rng(seed=19530)
rows = [
{default_primary_key_field_name: str(i), default_vector_field_name: list(rng.random((1, default_dim))[0]),
default_float_field_name: i * 1.0, default_string_field_name: str(i)} for i in range(default_nb)]
client_w.insert(client, collection_name, rows)[0]
pks = [str(i) for i in range(default_nb)]
log.debug(pks)
# 3. get first primary key
first_pk_data = client_w.get(client, collection_name, ids=pks[0:1])[0]
assert len(first_pk_data) == len(pks[0:1])
first_pk_data_1 = client_w.get(client, collection_name, ids="0")[0]
assert first_pk_data == first_pk_data_1
client_w.drop_collection(client, collection_name)
Environment details
- Hardware/Softward conditions (OS, CPU, GPU, Memory):
- Method of installation (Docker, or from source):
- Milvus version (v0.3.1, or v0.4.0): master latest
- pymilvus version: 2.5.0rc17
- Milvus configuration (Settings you made in `server_config.yaml`):
Anything else?
No response
/assign @czs007