Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: query should return the latest inserted entity if there are dupicate primary keys #33883

Closed
1 task done
yanliang567 opened this issue Jun 14, 2024 · 3 comments
Closed
1 task done
Assignees
Labels
kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@yanliang567
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- Milvus version: standalone
- Deployment mode(standalone or cluster): 2.4.4
- MQ type(rocksmq, pulsar or kafka):    
- SDK version(e.g. pymilvus v2.0.0rc2): pymilvus 2.4.3

Current Behavior

query returns the oldest entity if there are duplicate primary keys

Expected Behavior

returns the latest entity

Steps To Reproduce

1. create a collection
2. insert 2000 entities with dup_id=0
3. query with expr='id==0'

run the test below

Milvus Log

No response

Anything else?

@pytest.mark.tags(CaseLabel.L1)
    def test_query_to_get_latest_entity_with_dup_ids(self):
        """
        target: test query to get latest entity with duplicate primary keys
        method: 1.create collection and insert dup primary key = 0
                2.query with expr=dup_id
        expected: return the latest entity
        """
        collection_w = self.init_collection_wrap(name=cf.gen_unique_str(prefix))
        nb = 200
        rounds = 10
        for i in range(rounds):
            df = cf.gen_default_dataframe_data(nb=nb, start=i * nb)
            df[ct.default_int64_field_name] = 0
            collection_w.insert(df)
        collection_w.create_index(ct.default_float_vec_field_name, index_params=ct.default_index)
        collection_w.load()
        expr = f'{ct.default_int64_field_name} == 0'
        res = collection_w.query(expr=expr, output_fields=[ct.default_int64_field_name, ct.default_float_field_name])[0]
        assert len(res) == 1 and res[0][ct.default_float_field_name] == (rounds * nb - 1) * 1.0
@yanliang567 yanliang567 added kind/bug Issues or changes related a bug needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 14, 2024
@yanliang567 yanliang567 self-assigned this Jun 14, 2024
@yanliang567
Copy link
Contributor Author

/assign @tedxu
/unassign

@sre-ci-robot sre-ci-robot assigned tedxu and unassigned yanliang567 Jun 14, 2024
@yanliang567 yanliang567 added triage/needs-information Indicates an issue needs more information in order to work on it. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 14, 2024
@yanliang567 yanliang567 added this to the 2.4.5 milestone Jun 14, 2024
@yanliang567 yanliang567 added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed triage/needs-information Indicates an issue needs more information in order to work on it. labels Jun 14, 2024
@smellthemoon
Copy link
Contributor

smellthemoon commented Jun 17, 2024

I will take a look.
/assign

@yanliang567 yanliang567 assigned smellthemoon and unassigned tedxu Jun 17, 2024
congqixia added a commit to congqixia/milvus that referenced this issue Jun 17, 2024
See also milvus-io#33883

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
sre-ci-robot pushed a commit that referenced this issue Jun 18, 2024
…33936)

See also #33883

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
congqixia added a commit to congqixia/milvus that referenced this issue Jun 20, 2024
…ilvus-io#33936)

See also milvus-io#33883

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
congqixia added a commit to congqixia/milvus that referenced this issue Jun 20, 2024
sre-ci-robot pushed a commit that referenced this issue Jun 20, 2024
… PK(#33936) (#34026)

Cherry-pick from master
pr: #33936
See also #33883

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
sre-ci-robot pushed a commit that referenced this issue Jun 21, 2024
… PK (#33936) (#34024)

Cherry-pick from master
pr: #33936
See also #33883

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
sre-ci-robot pushed a commit that referenced this issue Jun 21, 2024
…ds (#34057)

related issue: #33883

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
sre-ci-robot pushed a commit that referenced this issue Jun 24, 2024
…y with dup ids (#34069)

related issue: #33883
pr: #34057

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
@yanliang567 yanliang567 modified the milestones: 2.4.5, 2.4.6 Jun 26, 2024
yellow-shine pushed a commit to yellow-shine/milvus that referenced this issue Jul 2, 2024
…ilvus-io#33936)

See also milvus-io#33883

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
yellow-shine pushed a commit to yellow-shine/milvus that referenced this issue Jul 2, 2024
…ds (milvus-io#34057)

related issue: milvus-io#33883

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
@yanliang567 yanliang567 modified the milestones: 2.4.6, 2.4.7 Jul 19, 2024
@yanliang567
Copy link
Contributor Author

verified and new testcased added accordingly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

3 participants