-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add MV_CONTAINS function #133099
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
Add MV_CONTAINS function #133099
Conversation
…entation improvements. Fix issue with byteref being empty, which caused fold to fail.
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
|
Hi @mjmbischoff, I've created a changelog YAML for you. |
|
Hi @mjmbischoff, I've updated the changelog YAML for you. |
Agree. If we add an infix operator will create a class for it as invert the operator order, but that will be a followup PR. |
- Fixing tests by removing logic to return null if all parameters are null. The standard generator had to be circumvented, should follow up with separate PR to make it more intelligent to avoid it. - Overwritten part of the test methods to avoid the null expectation.
|
Had to do quite a bit(too much?) to follow the contract of always returning a boolean vs null if any argument is null, which the test classes seem to expect. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good! It's a shame you had to create a custom evaluator; I guess we'll have to invest some extra time there, as MV functions can usually handle nulls
...java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvContainsTests.java
Show resolved
Hide resolved
...java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvContainsTests.java
Show resolved
Hide resolved
docs/reference/query-languages/esql/_snippets/lists/mv-functions.md
Outdated
Show resolved
Hide resolved
...main/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvContains.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Iván Cea Fontenla <[email protected]>
💔 Backport failedThe backport operation could not be completed due to the following error: You can use sqren/backport to manually backport by running |
This reverts commit 1e58428.
|
This commit introduced compile errors, I have reverted it from |
ESQL: Track memory in evaluators (elastic#133392) got merged to main at the same as Add MV_CONTAINS function elastic#133099 which caused a compile-error and the merge was reverted. This commit addresses the compile-error.
Adding the MV_CONTAINS_ALL function.
The function checks if the multivalue expression that is supplied as the first argument resolves to all values yielded by the multivalue expression that is the second argument. Effectively establishing if the first argument is a super set of the second argument which would then be the subset. This allows for a contains element function that also has the flexibility to work with multivalue arguments. Since we compare each entry duplicates collapse as we simply match against the same entry on the other side.
This avoids the need to abuse string functions to check if something is one of the multi values.:
the function allows for multivalue so the following should also work:
TODO