-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Implement v_magnitude function #132765
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
Implement v_magnitude function #132765
Conversation
🔍 Preview links for changed docs |
...lasticsearch/xpack/esql/expression/function/vector/AbstractVectorScalarFunctionTestCase.java
Outdated
Show resolved
Hide resolved
| return floatArray; | ||
| } | ||
|
|
||
| protected double calculateSimilarity(List<Float> left, List<Float> right) { |
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.
was unused
...in/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/vector/Magnitude.java
Show resolved
Hide resolved
...rc/internalClusterTest/java/org/elasticsearch/xpack/esql/vector/VectorScalarFunctionsIT.java
Outdated
Show resolved
Hide resolved
...rc/internalClusterTest/java/org/elasticsearch/xpack/esql/vector/VectorScalarFunctionsIT.java
Outdated
Show resolved
Hide resolved
...rc/internalClusterTest/java/org/elasticsearch/xpack/esql/vector/VectorScalarFunctionsIT.java
Outdated
Show resolved
Hide resolved
...rc/internalClusterTest/java/org/elasticsearch/xpack/esql/vector/VectorScalarFunctionsIT.java
Outdated
Show resolved
Hide resolved
...in/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/vector/Magnitude.java
Outdated
Show resolved
Hide resolved
.../main/java/org/elasticsearch/xpack/esql/expression/function/vector/VectorScalarFunction.java
Outdated
Show resolved
Hide resolved
...lasticsearch/xpack/esql/expression/function/vector/AbstractVectorScalarFunctionTestCase.java
Outdated
Show resolved
Hide resolved
...lasticsearch/xpack/esql/expression/function/vector/AbstractVectorScalarFunctionTestCase.java
Outdated
Show resolved
Hide resolved
...lasticsearch/xpack/esql/expression/function/vector/AbstractVectorScalarFunctionTestCase.java
Outdated
Show resolved
Hide resolved
...icsearch/xpack/esql/expression/function/vector/AbstractVectorSimilarityFunctionTestCase.java
Show resolved
Hide resolved
…expression/function/vector/Magnitude.java Co-authored-by: Carlos Delgado <[email protected]>
…expression/function/vector/AbstractVectorScalarFunctionTestCase.java Co-authored-by: Carlos Delgado <[email protected]>
…expression/function/vector/VectorScalarFunction.java Co-authored-by: Carlos Delgado <[email protected]>
.../main/java/org/elasticsearch/xpack/esql/expression/function/vector/VectorScalarFunction.java
Outdated
Show resolved
Hide resolved
| float[] array = listToFloatArray(input); | ||
| double expected = scalarFunction.calculateScalar(array); | ||
| return new TestCaseSupplier.TestCase( | ||
| List.of(new TestCaseSupplier.TypedData(input, DENSE_VECTOR, "vector")), |
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.
@carlosdelest thanks for updating this!
carlosdelest
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.
LGTM.
A couple of suggestions for you to evaluate, but looks really good! 💯
x-pack/plugin/esql/qa/testFixtures/src/main/resources/vector-magnitude.csv-spec
Show resolved
Hide resolved
...in/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/vector/Magnitude.java
Show resolved
Hide resolved
...in/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/vector/Magnitude.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Carlos Delgado <[email protected]>
…expression/function/vector/Magnitude.java Co-authored-by: Carlos Delgado <[email protected]>
…agnitude.csv-spec Co-authored-by: Carlos Delgado <[email protected]>
* upstream/main: (32 commits) Speed up loading keyword fields with index sorts (elastic#132950) Mute org.elasticsearch.index.mapper.LongFieldMapperTests testSyntheticSourceWithTranslogSnapshot elastic#132964 Simplify EsqlSession (elastic#132848) Implement WriteLoadConstraintDecider#canAllocate (elastic#132041) Mute org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT test {p0=search/400_synthetic_source/_doc_count} elastic#132965 Switch to PR-based benchmark pipeline defined in ES repo (elastic#132941) Breakdown undesired allocations by shard routing role (elastic#132235) Implement v_magnitude function (elastic#132765) Introduce execution location marker for better handling of remote/local compatibility (elastic#132205) Mute org.elasticsearch.cluster.ClusterInfoServiceIT testMaxQueueLatenciesInClusterInfo elastic#132957 Unmuting simulate index data stream mapping overrides yaml rest test (elastic#132946) Remove CrossClusterCancellationIT.createLocalIndex() (elastic#132952) Mute org.elasticsearch.index.mapper.LongFieldMapperTests testFetch elastic#132956 Fix failing UT by adding a required capability (elastic#132947) Precompute the BitsetCacheKey hashCode (elastic#132875) Adding simulate ingest effective mapping (elastic#132833) Mute org.elasticsearch.index.mapper.LongFieldMapperTests testFetchMany elastic#132948 Rename skipping logic to remove hard link to skip_unavailable (elastic#132861) Store ignored source in unique stored fields per entry (elastic#132142) Add random tests with match_only_text multi-field (elastic#132380) ...
Implements v_magnitude ESQL function
…-stats * upstream/main: (36 commits) Fix reproducability of builds against Java EA versions (elastic#132847) Speed up loading keyword fields with index sorts (elastic#132950) Mute org.elasticsearch.index.mapper.LongFieldMapperTests testSyntheticSourceWithTranslogSnapshot elastic#132964 Simplify EsqlSession (elastic#132848) Implement WriteLoadConstraintDecider#canAllocate (elastic#132041) Mute org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT test {p0=search/400_synthetic_source/_doc_count} elastic#132965 Switch to PR-based benchmark pipeline defined in ES repo (elastic#132941) Breakdown undesired allocations by shard routing role (elastic#132235) Implement v_magnitude function (elastic#132765) Introduce execution location marker for better handling of remote/local compatibility (elastic#132205) Mute org.elasticsearch.cluster.ClusterInfoServiceIT testMaxQueueLatenciesInClusterInfo elastic#132957 Unmuting simulate index data stream mapping overrides yaml rest test (elastic#132946) Remove CrossClusterCancellationIT.createLocalIndex() (elastic#132952) Mute org.elasticsearch.index.mapper.LongFieldMapperTests testFetch elastic#132956 Fix failing UT by adding a required capability (elastic#132947) Precompute the BitsetCacheKey hashCode (elastic#132875) Adding simulate ingest effective mapping (elastic#132833) Mute org.elasticsearch.index.mapper.LongFieldMapperTests testFetchMany elastic#132948 Rename skipping logic to remove hard link to skip_unavailable (elastic#132861) Store ignored source in unique stored fields per entry (elastic#132142) ...
Implements #132768