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 filter with JSON: "AND" not working, must be "&&" (documentation issue?) #38864

Open
1 task done
chbussler opened this issue Dec 30, 2024 · 8 comments · May be fixed by #38927
Open
1 task done

[Bug]: Query filter with JSON: "AND" not working, must be "&&" (documentation issue?) #38864

chbussler opened this issue Dec 30, 2024 · 8 comments · May be fixed by #38927
Assignees
Labels
help wanted Extra attention is needed kind/bug Issues or changes related a bug

Comments

@chbussler
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Environment

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

Current Behavior

Milvus raises exception:

raise MilvusException(status.code, status.reason, status.error_code)
pymilvus.exceptions.MilvusException: <MilvusException: (code=1100, message=failed to create delete plan: cannot parse expression: storage_object_id["storage_bucket_name"] == "drag-b-10" AND storage_object_id["storage_bucket_time_created"] == "2024-12-24 04:27:00.016000" AND storage_object_id["name"] == "t1.txt" AND storage_object_id["generation"] == "1735487491829867" , error: invalid expression: storage_object_id["storage_bucket_name"] == "drag-b-10" AND storage_object_id["storage_bucket_time_created"] == "2024-12-24 04:27:00.016000" AND storage_object_id["name"] == "t1.txt" AND storage_object_id["generation"] == "1735487491829867" : invalid parameter)>

Expected Behavior

Milvus does not raise exception when AND is replaced by &&:

storage_object_id["storage_bucket_name"] == "drag-b-10" && storage_object_id["storage_bucket_time_created"] == "2024-12-24 04:27:00.016000" && storage_object_id["name"] == "t1.txt" && storage_object_id["generation"] == "1735568888486502"

The documentation says to use AND, the code says to use &&: https://milvus.io/docs/use-json-fields.md

The expected behavior is

  1. both, code and documentation, are consistent
  2. when a parse error exception is raised, the text displayed not only states that there was a parse exception, but what it was. For each user-visible error: state what it was, explain it, state how to fix it

Steps To Reproduce

You can manually reproduce this 

- with Attu by constructing the filter using the filter construction dialog and see that it uses "&&". 
- When you replace "&&" with "AND", there is an exception raised in a user dialog.

Milvus Log

No response

Anything else?

No response

@chbussler chbussler 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 Dec 30, 2024
@xiaofan-luan
Copy link
Collaborator

/assign @xiaocai2333

@xiaocai2333
Copy link
Contributor

Milvus's expression parsing is case-sensitive. Currently, we have only defined and in the g4 file. Please try using and.

AND: '&&' | 'and';
OR: '||' | 'or';

@xiaocai2333
Copy link
Contributor

/assign @chbussler

@yanliang567 yanliang567 added help wanted Extra attention is needed and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Dec 31, 2024
@xiaofan-luan
Copy link
Collaborator

/assign @chbussler

LOL, I didn't know this etier

@chbussler
Copy link
Author

Still, the documentation isn't matching the code then: https://milvus.io/docs/boolean.md

  • Documentation says AND, not and
  • Documentation does not state that && is a valid operator as well

And there are other terminals like LIKE, IN, OR (see your code extract above), NOT that have a similar issue as AND.

As a side note, Attu uses && as operator when generating the expression from the expression builder.

@xiaofan-luan
Copy link
Collaborator

//milvus.io/docs/boolean.md

Agree, thanks for the feedback.

we will fix the document as soon as possible

@xiaofan-luan
Copy link
Collaborator

actaully let's fix the compiler as well.
At least for IN we support both in and IN

@xiaofan-luan
Copy link
Collaborator

docuement request and pr is submitted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed kind/bug Issues or changes related a bug
Projects
None yet
4 participants