-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
kind/bugIssues or changes related a bugIssues or changes related a bugtriage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Environment
- Milvus version: master-20250421-ac1e0437-amd64
- Deployment mode(standalone or cluster): both
- MQ type(rocksmq, pulsar or kafka): all
- SDK version(e.g. pymilvus v2.0.0rc2): 2.6.0rc115
- OS(Ubuntu or CentOS):
- CPU/Memory:
- GPU:
- Others:
Current Behavior
Insert failed reporting "{float_vector} field should be a INT8_VECTOR, but got a {<class 'numpy.ndarray'>} instead." when insert INT8_VECTOR through column ways
>>> res = collection.insert([[i for i in range(nb)], vectors])
2025-04-23 16:41:26,585 [ERROR][handler]: RPC error: [batch_insert], <DataNotMatchException: (code=1, message=The Input data type is inconsistent with defined schema, {float_vector} field should be a INT8_VECTOR, but got a {<class 'numpy.ndarray'>} instead.)>, <Time:{'RPC start': '2025-04-23 16:41:26.417898', 'RPC error': '2025-04-23 16:41:26.585700'}> (decorators.py:140)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/binbin/milvus_latest_env_3.11/lib/python3.11/site-packages/pymilvus/orm/collection.py", line 518, in insert
return conn.batch_insert(
^^^^^^^^^^^^^^^^^^
File "/Users/binbin/milvus_latest_env_3.11/lib/python3.11/site-packages/pymilvus/decorators.py", line 141, in handler
raise e from e
File "/Users/binbin/milvus_latest_env_3.11/lib/python3.11/site-packages/pymilvus/decorators.py", line 137, in handler
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/binbin/milvus_latest_env_3.11/lib/python3.11/site-packages/pymilvus/decorators.py", line 176, in handler
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/binbin/milvus_latest_env_3.11/lib/python3.11/site-packages/pymilvus/decorators.py", line 116, in handler
raise e from e
File "/Users/binbin/milvus_latest_env_3.11/lib/python3.11/site-packages/pymilvus/decorators.py", line 86, in handler
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/binbin/milvus_latest_env_3.11/lib/python3.11/site-packages/pymilvus/client/grpc_handler.py", line 685, in batch_insert
raise err from err
File "/Users/binbin/milvus_latest_env_3.11/lib/python3.11/site-packages/pymilvus/client/grpc_handler.py", line 668, in batch_insert
request = self._prepare_batch_insert_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/binbin/milvus_latest_env_3.11/lib/python3.11/site-packages/pymilvus/client/grpc_handler.py", line 652, in _prepare_batch_insert_request
else Prepare.batch_insert_param(collection_name, entities, partition_name, fields_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/binbin/milvus_latest_env_3.11/lib/python3.11/site-packages/pymilvus/client/prepare.py", line 773, in batch_insert_param
return cls._parse_batch_request(request, entities, fields_info, location)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/binbin/milvus_latest_env_3.11/lib/python3.11/site-packages/pymilvus/client/prepare.py", line 749, in _parse_batch_request
field_data = entity_helper.entity_to_field_data(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/binbin/milvus_latest_env_3.11/lib/python3.11/site-packages/pymilvus/client/entity_helper.py", line 515, in entity_to_field_data
raise DataNotMatchException(
pymilvus.exceptions.DataNotMatchException: <DataNotMatchException: (code=1, message=The Input data type is inconsistent with defined schema, {float_vector} field should be a INT8_VECTOR, but got a {<class 'numpy.ndarray'>} instead.)>
Expected Behavior
Insert successfully
Steps To Reproduce
from pymilvus import CollectionSchema, FieldSchema
from pymilvus import Collection
from pymilvus import connections
from pymilvus import DataType
from pymilvus import Partition
from pymilvus import utility
import json
connections.connect()
int64_field = FieldSchema(name="int64", dtype=DataType.INT64, is_primary=True)
float_vector = FieldSchema(name="float_vector", dtype=DataType.INT8_VECTOR, dim=dim)
schema = CollectionSchema(fields=[int64_field, float_vector])
import numpy as np
import random
collection = Collection("test_search_collection_binbin_tmp_0", schema=schema)
nb=10
def gen_int8_vectors(num, dim):
raw_vectors = []
int8_vectors = []
for _ in range(num):
raw_vector = [random.randint(-128, 127) for _ in range(dim)]
raw_vectors.append(raw_vector)
int8_vector = np.array(raw_vector, dtype=np.int8)
int8_vectors.append(int8_vector)
return raw_vectors, int8_vectors
vectors = gen_int8_vectors(nb, dim)[1]
res = collection.insert([[i for i in range(nb)], vectors])
Milvus Log
Anything else?
No response
Metadata
Metadata
Labels
kind/bugIssues or changes related a bugIssues or changes related a bugtriage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.