-
Notifications
You must be signed in to change notification settings - Fork 25.8k
ES|QL: Add MV_INTERSECTION Function #139379
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
ES|QL: Add MV_INTERSECTION Function #139379
Conversation
ℹ️ Important: Docs version tagging👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version. We use applies_to tags to mark version-specific features and changes. Expand for a quick overviewWhen to use applies_to tags:✅ At the page level to indicate which products/deployments the content applies to (mandatory) What NOT to do:❌ Don't remove or replace information that applies to an older version 🤔 Need help?
|
|
Hi @markjhoy, I've created a changelog YAML for you. |
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
|
Pinging @elastic/search-eng (Team:SearchOrg) |
| @Example(file = "mv_intersect", tag = "testMvIntersectWithBooleanValues"), | ||
| @Example(file = "mv_intersect", tag = "testMvIntersectWithDoubleValues"), | ||
| @Example(file = "mv_intersect", tag = "testMvIntersectWithBytesRefValues") }, | ||
| appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.3.0") } |
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.
Just to doublecheck - are the tags here correct? (Preview for 9.3.0?)
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.
LGTM!
kderusso
left a comment
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.
Changes LGTM, will defer to Ioana to approve after her feedback is met. Thanks!
|
|
||
| } | ||
|
|
||
| public void testMvIntersectValidatesDataTypesAreEqual() { |
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.
Any tests needed for null input, etc?
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.
There's one at least in the IT tests ({null, null} -> {null}) as well as others that check for null as the first or second argument - so, I don't think it needs to be in the verifier... however the validation is going to change a bit from Ioana's suggestions...
|
When comparing this with the geospatial functions, I would naturally think this function should be called
|
craigtaverner
left a comment
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.
I think we need to re-think the name. I propose MV_INTERSECTION both to better match set-theory as well as better symmetry with related GIS functions.
...ain/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvIntersect.java
Outdated
Show resolved
Hide resolved
...ain/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvIntersect.java
Outdated
Show resolved
Hide resolved
...sql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java
Outdated
Show resolved
Hide resolved
@craigtaverner that makes sense to change it to |
|
Good call @craigtaverner - I'll refactor, and I've also updated the meta issue as well to reflect this. |
Thanks! Great that you fixed the meta-issue too. Sometimes those issues are just a first guess as to what we need, so always good to second-guess! 😄 |
craigtaverner
left a comment
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.
Much nicer with the name change!
leemthompo
left a comment
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.
Thanks for iterating on the docs! One tiny little thing left to add: an inline applies_to tag in the list :)
docs/reference/query-languages/esql/_snippets/lists/mv-functions.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Liam Thompson <[email protected]>
All set. Thanks for your help! |
x-pack/plugin/esql/qa/testFixtures/src/main/resources/mv_intersection.csv-spec
Show resolved
Hide resolved
x-pack/plugin/esql/qa/testFixtures/src/main/resources/mv_intersection.csv-spec
Show resolved
Hide resolved
|
buildkite test this |
Adds MV_INTERSECTION function to ES|QL.
Returns a subset of the inputs sets that contains the intersection of values in provided multi-valued arguments.
Example: