milvus icon indicating copy to clipboard operation
milvus copied to clipboard

[Bug]: [Nightly]Test collection with float type raised an unexpected error

Open NicoYuan1986 opened this issue 2 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Environment

- Milvus version:master(5141e05)
- Deployment mode(standalone or cluster):cluster && standalone
- SDK version(e.g. pymilvus v2.0.0rc2):2.2.0.dev30
- OS(Ubuntu or CentOS): 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

Test collection with float type raised an unexpected error.

[2022-09-21T01:05:42.151Z] [2022-09-20 21:03:28 - ERROR - pymilvus.decorators]: Unexcepted error: [create_collection], 5.0 has type float, but expected one of: int, long, <Time: {'RPC start': '2022-09-20 21:03:28.080239', 'Exception': '2022-09-20 21:03:28.080310'}> (decorators.py:112)
[2022-09-21T01:05:42.151Z] [2022-09-20 21:03:28 - ERROR - ci_test]: Traceback (most recent call last):
[2022-09-21T01:05:42.151Z]   File "/home/jenkins/agent/workspace/tests/python_client/utils/api_request.py", line 26, in inner_wrapper
[2022-09-21T01:05:42.151Z]     res = func(*args, **_kwargs)
[2022-09-21T01:05:42.151Z]   File "/home/jenkins/agent/workspace/tests/python_client/utils/api_request.py", line 57, in api_request
[2022-09-21T01:05:42.151Z]     return func(*arg, **kwargs)
[2022-09-21T01:05:42.151Z]   File "/usr/local/lib/python3.8/site-packages/pymilvus/orm/collection.py", line 139, in __init__
[2022-09-21T01:05:42.151Z]     conn.create_collection(self._name, fields=schema, shards_num=self._shards_num,
[2022-09-21T01:05:42.151Z]   File "/usr/local/lib/python3.8/site-packages/pymilvus/decorators.py", line 113, in handler
[2022-09-21T01:05:42.151Z]     raise e
[2022-09-21T01:05:42.151Z]   File "/usr/local/lib/python3.8/site-packages/pymilvus/decorators.py", line 97, in handler
[2022-09-21T01:05:42.151Z]     return func(*args, **kwargs)
[2022-09-21T01:05:42.151Z]   File "/usr/local/lib/python3.8/site-packages/pymilvus/decorators.py", line 127, in handler
[2022-09-21T01:05:42.151Z]     ret = func(self, *args, **kwargs)
[2022-09-21T01:05:42.151Z]   File "/usr/local/lib/python3.8/site-packages/pymilvus/decorators.py", line 79, in handler
[2022-09-21T01:05:42.151Z]     raise e
[2022-09-21T01:05:42.151Z]   File "/usr/local/lib/python3.8/site-packages/pymilvus/decorators.py", line 50, in handler
[2022-09-21T01:05:42.151Z]     return func(self, *args, **kwargs)
[2022-09-21T01:05:42.151Z]   File "/usr/local/lib/python3.8/site-packages/pymilvus/client/grpc_handler.py", line 210, in create_collection
[2022-09-21T01:05:42.151Z]     request = Prepare.create_collection_request(collection_name, fields, shards_num=shards_num, **kwargs)
[2022-09-21T01:05:42.151Z]   File "/usr/local/lib/python3.8/site-packages/pymilvus/client/prepare.py", line 38, in create_collection_request
[2022-09-21T01:05:42.151Z]     schema = cls.get_schema_from_collection_schema(collection_name, fields, shards_num, **kwargs)
[2022-09-21T01:05:42.151Z]   File "/usr/local/lib/python3.8/site-packages/pymilvus/client/prepare.py", line 58, in get_schema_from_collection_schema
[2022-09-21T01:05:42.151Z]     field_schema = schema_types.FieldSchema(name=f.name,
[2022-09-21T01:05:42.151Z] TypeError: 5.0 has type float, but expected one of: int, long
[2022-09-21T01:05:42.151Z]  (api_request.py:39)
[2022-09-21T01:05:42.151Z] [2022-09-20 21:03:28 - ERROR - ci_test]: (api_response) : 5.0 has type float, but expected one of: int, long (api_request.py:40)

Expected Behavior

An error code and corresponding message should be returned.

Steps To Reproduce

The case may help.

    @pytest.mark.tags(CaseLabel.L2)
    def test_collection_field_dtype_float_value(self):
        """
        target: test collection with float type
        method: create field with float type
        expected: raise exception
        """
        self._connect()
        c_name = cf.gen_unique_str(prefix)
        field, _ = self.field_schema_wrap.init_field_schema(name=ct.default_int64_field_name, dtype=5.0,
                                                            is_primary=True)
        schema = cf.gen_collection_schema(fields=[field, cf.gen_float_vec_field()])
        error = {ct.err_code: 0, ct.err_msg: "Field type must be of DataType!"}
        self.collection_wrap.init_collection(c_name, schema=schema, check_task=CheckTasks.err_res, check_items=error)

Milvus Log

  1. collection name: collection_3X2LzpFB
  2. nightly: https://jenkins.milvus.io:18080/blue/organizations/jenkins/Milvus%20Nightly%20CI/detail/master/111/pipeline/171
  3. FAILED timeline: [2022-09-20T21:03:28.496Z] [gw1] [ 2%] FAILED testcases/test_collection.py::TestCollectionParams::test_collection_field_dtype_float_value
  4. milvus log: artifacts-milvus-distributed-pulsar-nightly-111-pymilvus-e2e-logs.tar.gz

Anything else?

No response

NicoYuan1986 avatar Sep 21 '22 08:09 NicoYuan1986

/assign @sunby /unassign

yanliang567 avatar Sep 21 '22 11:09 yanliang567

The problem comes up every day.

NicoYuan1986 avatar Sep 23 '22 02:09 NicoYuan1986

The issue has been solved. master: 911ea6c

NicoYuan1986 avatar Sep 27 '22 06:09 NicoYuan1986