milvus icon indicating copy to clipboard operation
milvus copied to clipboard

[Bug]: The returned search vectors are not expected because decimal digits number is wrong

Open NicoYuan1986 opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Environment

- Milvus version:
- Deployment mode(standalone or cluster):standalone
- MQ type(rocksmq, pulsar or kafka):    rocksmq
- SDK version(e.g. pymilvus v2.0.0rc2):2.4.0.dev12
- OS(Ubuntu or CentOS): 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

The returned search vectors are not expected because decimal digits number is wrong.

>       assert res[0][0].entity.float_vector == data[field_name][res[0][0].id]
E       AssertionError: assert [0.047443118,...34747913, ...] == [0.0474431171...67391494, ...]
E         At index 0 diff: 0.047443118 != 0.0474431171012048
E         Full diff:
E           [
E         -  0.0474431171012048,
E         ?            -------
E         +  0.047443118,
E         -  0.14323796581950182,...
E         
E         ...Full output truncated (293 lines hidden), use '-vv' to show

Expected Behavior

pass

Steps To Reproduce

    @pytest.mark.tags(CaseLabel.L2)
    @pytest.mark.parametrize("index, params",
                             zip(ct.all_index_types[:6],
                                 ct.default_index_params[:6]))
    def test_search_output_field_vector_after_different_index(self, index, params):
        """
        target: test search with output vector field after different index
        method: 1. create a collection and insert data
                2. create index and load
                3. search with output field vector
                4. check the result vectors should be equal to the inserted
        expected: search success
        """
        # 1. create a collection and insert data
        collection_w = self.init_collection_general(prefix, is_index=False)[0]
        data = cf.gen_default_dataframe_data()
        collection_w.insert(data)

        # 2. create index and load
        default_index = {"index_type": index, "params": params, "metric_type": "L2"}
        collection_w.create_index(field_name, default_index)
        collection_w.load()

        # 3. search with output field vector
        search_params = cf.gen_search_param(index)[0]
        res = collection_w.search(vectors[:1], default_search_field,
                                  search_params, 2, default_search_exp,
                                  output_fields=[field_name],
                                  check_task=CheckTasks.check_search_results,
                                  check_items={"nq": 1,
                                               "limit": 2})[0]

        # 4. check the result vectors should be equal to the inserted
        log.info(res[0][0].id)
        log.info(res[0][0].entity.float_vector)
        log.info(data['float_vector'][0])
        assert res[0][0].entity.float_vector == data[field_name][res[0][0].id]

Milvus Log

image

Anything else?

No response

NicoYuan1986 avatar Apr 21 '23 09:04 NicoYuan1986