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.
Just to doublecheck - are the tags here correct? (Preview for 9.3.0?)
kderusso
left a comment
There was a problem hiding this comment.
Changes LGTM, will defer to Ioana to approve after her feedback is met. Thanks!
|
|
||
| } | ||
|
|
||
| public void testMvIntersectValidatesDataTypesAreEqual() { |
There was a problem hiding this comment.
Any tests needed for null input, etc?
There was a problem hiding this comment.
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.
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.
Much nicer with the name change!
leemthompo
left a comment
There was a problem hiding this comment.
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 <leemthompo@gmail.com>
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: