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

针对不存在的id进行筛选删除时,固定返回删除条数为1 #1182

Open
Yiling1f opened this issue Nov 15, 2024 · 1 comment
Open

Comments

@Yiling1f
Copy link

描述
在Milvus SDK v2.4.x (Java)中,当表达式针对id进行筛选时,无论数据有没有被真实删除,都返回被删除条数为1。例如:试图删除id为1111的数据,但该数据在milvus数据库中不存在,删除操作也返回了被删除条数为1.

重现步骤

ConnectParam.Builder builder = ConnectParam.newBuilder()
    .withHost("xx.xxx.xx.xx")
    .withPort(19530);
MilvusClient milvusClient = new MilvusServiceClient(builder.build());

DeleteParam deleteRequest = DeleteParam.newBuilder()
    .withCollectionName("test")
    .withExpr("id == 1")
    .build();

R<MutationResult> result = milvusClient.delete(deleteRequest);
System.out.println("Deleted rows: " + result.getData().getDeleteCnt());

此处的id为任意数据库中不存在的值,执行后观察到返回的删除条数为1。

期待回复!

@Yiling1f Yiling1f changed the title 删除操作的expression针对id时,固定返回删除条数为1 针对不存在的id进行筛选删除时,固定返回删除条数为1 Nov 15, 2024
@yhmo
Copy link
Contributor

yhmo commented Nov 15, 2024

目前后台的逻辑是分两种情况处理的:

  1. id > 100 这种表达式,后台是把表里所有的id都查看了一遍,找出了 > 100的那些id,所以能够准确知道有多少个被删除。
  2. id == xxx 或者 id in [xxx, xxx] 这种表达式,后台为了省掉这个查询的时间,直接通过解析表达式来获得个数,id==xxx直接返回1,id in [xxx, xxx]是直接返回数组里的个数。然后真正的删除操作会异步执行。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants