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

[Enhancement]: Optimize expression parsing efficiency #36672

Open
1 task done
xiaocai2333 opened this issue Oct 8, 2024 · 9 comments
Open
1 task done

[Enhancement]: Optimize expression parsing efficiency #36672

xiaocai2333 opened this issue Oct 8, 2024 · 9 comments
Assignees
Labels
kind/enhancement Issues or changes related to enhancement stale indicates no udpates for 30 days

Comments

@xiaocai2333
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

What would you like to be added?

Optimize expression parsing efficiency.

  1. Optimize the time of parsing Chinese characters.
  2. Pass in the expression parameters to be queried through the template.
  • such as expr=pk > {age} and city in {city}, search_params={age:3, city:['beijing","shanghai"]}

Why is this needed?

No response

Anything else?

No response

@xiaofan-luan
Copy link
Collaborator

Excited about the template feature!

@zhengbuqian
Copy link
Collaborator

we now support nullable fields, how do we handle null in template?

@xiaocai2333
Copy link
Contributor Author

we now support nullable fields, how do we handle null in template?

Currently, our expression does not support null values. We can discuss it further when null support is added in the future.
/cc @smellthemoon

@xiaofan-luan
Copy link
Collaborator

null support is already added?

@xiaofan-luan
Copy link
Collaborator

did you mean isNull and isNotNull?
can we do a == null?

@zhengbuqian
Copy link
Collaborator

zhengbuqian commented Oct 24, 2024

did you mean isNull and isNotNull?

yes. we should be able to filter based on null. chatted with @smellthemoon offline, we don't currently support this.

Maybe we should not allow null in template, we can simply use a NULL keyword:

  • to use null only: a == NULL or a != NULL
  • to use null with non null values: a == 100 || a == NULL
  • to use null with template: a in [{accepted_values}] || a == NULL.
    • do not allow null in template values, it has to be provided directly in the expr

@smellthemoon
Copy link
Contributor

did you mean isNull and isNotNull?

yes. we should be able to filter based on null. chatted with @smellthemoon offline, we don't currently support this.

Maybe we should not allow null in template, we can simply use a NULL keyword:

  • to use null only: a == NULL or a != NULL
  • to use null with non null values: a == 100 || a == NULL
  • to use null with template: a in [{accepted_values}] || a == NULL

In fact, in the future, we will still not support expressions like == null and != null, which will directly report errors at the parse layer. Exposing the NULL keyword will bring a lot of complexity. It needs to be identified in all expressions, and the respective logical relationships need to be considered in complex expressions. Therefore, in the future, we will only support the form of isNull(field) and isNotNull(field).

@zhengbuqian
Copy link
Collaborator

did you mean isNull and isNotNull?

yes. we should be able to filter based on null. chatted with @smellthemoon offline, we don't currently support this.
Maybe we should not allow null in template, we can simply use a NULL keyword:

  • to use null only: a == NULL or a != NULL
  • to use null with non null values: a == 100 || a == NULL
  • to use null with template: a in [{accepted_values}] || a == NULL

In fact, in the future, we will still not support expressions like == null and != null, which will directly report errors at the parse layer. Exposing the NULL keyword will bring a lot of complexity. It needs to be identified in all expressions, and the respective logical relationships need to be considered in complex expressions. Therefore, in the future, we will only support the form of isNull(field) and isNotNull(field).

that is fine. as long as we have a way of checking null, we can remove the need to support null in expression template.

sre-ci-robot pushed a commit that referenced this issue Oct 28, 2024
xiaocai2333 added a commit to xiaocai2333/milvus that referenced this issue Oct 28, 2024
czs007 pushed a commit that referenced this issue Oct 29, 2024
… and OR operations (#37217)

issue: #36672

master pr: #37033

Signed-off-by: Cai Zhang <[email protected]>
sre-ci-robot pushed a commit to milvus-io/pymilvus that referenced this issue Oct 29, 2024
sre-ci-robot pushed a commit to milvus-io/pymilvus that referenced this issue Oct 29, 2024
xiaocai2333 added a commit to xiaocai2333/milvus that referenced this issue Oct 29, 2024
xiaocai2333 added a commit to xiaocai2333/milvus that referenced this issue Oct 30, 2024
sre-ci-robot pushed a commit that referenced this issue Oct 31, 2024
)

issue: #36672

The expression supports filling elements through templates, which helps
to reduce the overhead of parsing the elements.

---------

Signed-off-by: Cai Zhang <[email protected]>
sre-ci-robot pushed a commit that referenced this issue Oct 31, 2024
sre-ci-robot pushed a commit that referenced this issue Nov 3, 2024
sre-ci-robot pushed a commit that referenced this issue Nov 3, 2024
sre-ci-robot pushed a commit that referenced this issue Nov 7, 2024
sre-ci-robot pushed a commit that referenced this issue Nov 7, 2024
CaoHaiNam pushed a commit to CaoHaiNam/pymilvus that referenced this issue Nov 7, 2024
sre-ci-robot pushed a commit that referenced this issue Dec 2, 2024
Copy link

stale bot commented Dec 4, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Rotten issues close after 30d of inactivity. Reopen the issue with /reopen.

@stale stale bot added the stale indicates no udpates for 30 days label Dec 4, 2024
sre-ci-robot pushed a commit that referenced this issue Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Issues or changes related to enhancement stale indicates no udpates for 30 days
Projects
None yet
Development

No branches or pull requests

4 participants