milvus-io / milvus

A cloud-native vector database, storage for next generation AI applications
https://milvus.io
Apache License 2.0
30.29k stars 2.91k forks source link

[Bug]: GreaterThan is not supported in execution backend #30677

Open dhilazo opened 8 months ago

dhilazo commented 8 months ago

Is there an existing issue for this?

Environment

- Milvus version:2.3.3
- Deployment mode(standalone or cluster): standalone
- SDK version(e.g. pymilvus v2.0.0rc2): pymilvus v2.3.3
- OS(Ubuntu or CentOS): MacOS
- CPU/Memory: N/A
- GPU: N/A

Current Behavior

Based on the documentation for array limits there are a set of boolean operations that can be done with an array field, like array_length(int_array) > 10 (extracted from the documentation). However, when working with arrays only == operands work.

For example with this FieldSchema defined with pymilvus:

FieldSchema(name="test", dtype=DataType.ARRAY, element_type=DataType.VARCHAR, max_capacity=100, max_length=65535)

The array_length(test) > 2 expression returns GreaterThan is not supported in execution backend.

Expected Behavior

It should work just like it says in the documentation.

Steps To Reproduce

1. Define a collection with this field: `FieldSchema(name="test", dtype=DataType.ARRAY, element_type=DataType.VARCHAR, max_capacity=100, max_length=65535)`
2. Do a query with this expression using the `pymilvus` package: `array_length(test) > 2`

Milvus Log

pymilvus.exceptions.MilvusException: <MilvusException: (code=65535, message=cannot parse expression: array_length(test) > 2, error: GreaterThan is not supported in execution backend)>

Anything else?

No response

xiaofan-luan commented 8 months ago

/assign @xiaocai2333

maybe we can support it real quick

yanliang567 commented 8 months ago

I think there is some mistakes in the doc. I will double check it.

xiaofan-luan commented 8 months ago

should be a easy fix to that if == is support

yanliang567 commented 8 months ago

confirmed that right now Milvus only supports == and != for array_length, so the doc should be updated. @dhilazo sorry for the inconvenience, and @xiaocai2333 is working on support of more expression such as >, < .

/unassign

dhilazo commented 8 months ago

Thank you very much for your quick responses and support! ❤️

yanliang567 commented 8 months ago

/assign @elstic please help to add some tests for the verification /unassign @xiaocai2333