ES|QL - Add vector similarity functions to tech preview, allow pushdown of blockloader functions#139365
Conversation
…S_PUSHDOWN capability and use it on specific functions
|
Hi @carlosdelest, I've created a changelog YAML for you. |
| ); | ||
| } | ||
|
|
||
| public void testVCosine() throws IOException { |
There was a problem hiding this comment.
Vector similarity functions tests have been moved to PushVectorSimilarityToLoadIT, as they don't need the check now. We should merge them together again when pushing down is not behind snapshot.
|
|
||
| @Override | ||
| public PushedBlockLoaderExpression tryPushToFieldLoading(SearchStats stats) { | ||
| if (EsqlCapabilities.Cap.BLOCK_LOADER_EXPRESSIONS_PUSHDOWN.isEnabled() == false) { |
There was a problem hiding this comment.
Checks pushdown capability on the pushdown for all the non-vector similarity functions
There was a problem hiding this comment.
This is how I'd do it too, but I think we should enable all of these now.
| def(Magnitude.class, Magnitude::new, "v_magnitude"), | ||
| def(Hamming.class, Hamming::new, "v_hamming") } }; | ||
| // dense vector functions | ||
| def(Magnitude.class, Magnitude::new, "v_magnitude")} }; |
There was a problem hiding this comment.
V_MAGNITUDE is still not pushed down - #137535 tracks that
| new InferIsNotNull(), | ||
| new InferNonNullAggConstraint(), | ||
| new ReplaceDateTruncBucketWithRoundTo(), | ||
| new PushExpressionsToFieldLoad() |
There was a problem hiding this comment.
Add the PushExpressionsToFieldLoad rule by default - now the BlockLoaderExpression.tryPushToFieldLoading method needs to take into account pushdown capabilities
🔍 Preview links for changed docs |
ℹ️ 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?
|
|
Pinging @elastic/es-search-relevance (Team:Search Relevance) |
| checkVectorFunctionsNullArgs("v_magnitude(null)"); | ||
| if (EsqlCapabilities.Cap.MAGNITUDE_SCALAR_VECTOR_FUNCTION.isEnabled()) { | ||
| checkVectorFunctionsNullArgs("v_magnitude(null)"); | ||
| } | ||
| if (EsqlCapabilities.Cap.HAMMING_VECTOR_SIMILARITY_FUNCTION.isEnabled()) { |
There was a problem hiding this comment.
I think something is not right here - shouldn't v_magnitude tests still be skipped for non snapshot builds and the v_hamming ones be executed without a cap check?
There was a problem hiding this comment.
Oh I screwed up here, thanks for the catch!
I'm fixing in 21f8197, and adding the test-release label
|
Failures are due to packaging and to #139401 |
…or-similarity-functions-tech-preview
…milarity-functions-tech-preview' into enhancement/esql-vector-similarity-functions-tech-preview
There was a problem hiding this comment.
Taking the vector similarity functions to preview looks right to me.
Enabling pushdown looks right. The per-function-opt-out looks right, though I'd prefer if we didn't do it. I'd save that for a follow-up PR, but I have naming objections to the new capability you used. And, I figure, fixing the name is only marginally less expensive than dropping it entirely.
I have no strong opinion on if you should keep PushVectorSimilarityToLoadIT or move everything back into the original file. You don't have to keep it if you remove the capability and globally enable the pushdowns. But you might like it for organizational purposes. After the split, PushExpressionToLoadIT does a lot of work around different shapes of queries and PushVectorSimilarityToLoadIT is much more readable.
| /** | ||
| * Support for {@link org.elasticsearch.xpack.esql.expression.function.blockloader.BlockLoaderExpression} pushdown | ||
| */ | ||
| BLOCK_LOADER_EXPRESSIONS_PUSHDOWN(Build.current().isSnapshot()), |
There was a problem hiding this comment.
Could you remove this entirely and enable all of the pushdowns? I think we're ready now.
|
|
||
| @Override | ||
| public PushedBlockLoaderExpression tryPushToFieldLoading(SearchStats stats) { | ||
| if (EsqlCapabilities.Cap.BLOCK_LOADER_EXPRESSIONS_PUSHDOWN.isEnabled() == false) { |
There was a problem hiding this comment.
This is how I'd do it too, but I think we should enable all of these now.
…wn of blockloader functions (elastic#139365)
Get the following vector similarity functions into release builds:
V_DOT_PRODUCT
V_COSINE
V_L1_NORM
V_L2_NORM
V_HAMMING
Vector similarity functions use function pushdown to blockloaders - see #137002
Other functions that use pushdown to blockloaders are being pushed down as well.