Skip to content

Commit 0730ef7

Browse files
Merge branch 'main' into fix/127690
2 parents 5245bde + 98296d7 commit 0730ef7

File tree

50 files changed

+277
-4236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+277
-4236
lines changed

benchmarks/src/main/java/org/elasticsearch/benchmark/vector/OSQScorerBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.apache.lucene.util.VectorUtil;
1818
import org.apache.lucene.util.quantization.OptimizedScalarQuantizer;
1919
import org.elasticsearch.common.logging.LogConfigurator;
20-
import org.elasticsearch.simdvec.ES91OSQVectorsScorer;
20+
import org.elasticsearch.simdvec.internal.vectorization.ES91OSQVectorsScorer;
2121
import org.elasticsearch.simdvec.internal.vectorization.ESVectorizationProvider;
2222
import org.openjdk.jmh.annotations.Benchmark;
2323
import org.openjdk.jmh.annotations.BenchmarkMode;

docs/changelog/127988.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 127988
2+
summary: Add emit time to hash aggregation status
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

libs/geo/src/test/java/org/elasticsearch/geometry/utils/SpatialEnvelopeVisitorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public void testVisitGeoPointsWrapping() {
134134
} else {
135135
// Both positive and negative x values exist, we need to decide which way to wrap the bbox
136136
double unwrappedWidth = maxPosX - minNegX;
137-
double wrappedWidth = (180 - minPosX) - (-180 - maxNegX);
137+
double wrappedWidth = 360.0 + maxNegX - minPosX;
138138
if (unwrappedWidth <= wrappedWidth) {
139139
// The smaller bbox is around the front of the planet, no dateline wrapping required
140140
assertRectangleResult(i + ": " + point, result, minNegX, maxPosX, maxY, minY, false);

libs/simdvec/src/main/java/org/elasticsearch/simdvec/ESVectorUtil.java

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@
99

1010
package org.elasticsearch.simdvec;
1111

12-
import org.apache.lucene.store.IndexInput;
1312
import org.apache.lucene.util.BitUtil;
1413
import org.apache.lucene.util.Constants;
1514
import org.elasticsearch.simdvec.internal.vectorization.ESVectorUtilSupport;
1615
import org.elasticsearch.simdvec.internal.vectorization.ESVectorizationProvider;
1716

18-
import java.io.IOException;
1917
import java.lang.invoke.MethodHandle;
2018
import java.lang.invoke.MethodHandles;
2119
import java.lang.invoke.MethodType;
@@ -43,10 +41,6 @@ public class ESVectorUtil {
4341

4442
private static final ESVectorUtilSupport IMPL = ESVectorizationProvider.getInstance().getVectorUtilSupport();
4543

46-
public static ES91OSQVectorsScorer getES91OSQVectorsScorer(IndexInput input, int dimension) throws IOException {
47-
return ESVectorizationProvider.getInstance().newES91OSQVectorsScorer(input, dimension);
48-
}
49-
5044
public static long ipByteBinByte(byte[] q, byte[] d) {
5145
if (q.length != d.length * B_QUERY) {
5246
throw new IllegalArgumentException("vector dimensions incompatible: " + q.length + "!= " + B_QUERY + " x " + d.length);
@@ -217,40 +211,4 @@ public static void centerAndCalculateOSQStatsDp(float[] target, float[] centroid
217211
assert stats.length == 6;
218212
IMPL.centerAndCalculateOSQStatsDp(target, centroid, centered, stats);
219213
}
220-
221-
/**
222-
* Calculates the difference between two vectors and stores the result in a third vector.
223-
* @param v1 the first vector
224-
* @param v2 the second vector
225-
* @param result the result vector, must be the same length as the input vectors
226-
*/
227-
public static void subtract(float[] v1, float[] v2, float[] result) {
228-
if (v1.length != v2.length) {
229-
throw new IllegalArgumentException("vector dimensions differ: " + v1.length + "!=" + v2.length);
230-
}
231-
if (result.length != v1.length) {
232-
throw new IllegalArgumentException("vector dimensions differ: " + result.length + "!=" + v1.length);
233-
}
234-
for (int i = 0; i < v1.length; i++) {
235-
result[i] = v1[i] - v2[i];
236-
}
237-
}
238-
239-
/**
240-
* calculates the spill-over score for a vector and a centroid, given its residual with
241-
* its actually nearest centroid
242-
* @param v1 the vector
243-
* @param centroid the centroid
244-
* @param originalResidual the residual with the actually nearest centroid
245-
* @return the spill-over score (soar)
246-
*/
247-
public static float soarResidual(float[] v1, float[] centroid, float[] originalResidual) {
248-
if (v1.length != centroid.length) {
249-
throw new IllegalArgumentException("vector dimensions differ: " + v1.length + "!=" + centroid.length);
250-
}
251-
if (originalResidual.length != v1.length) {
252-
throw new IllegalArgumentException("vector dimensions differ: " + originalResidual.length + "!=" + v1.length);
253-
}
254-
return IMPL.soarResidual(v1, centroid, originalResidual);
255-
}
256214
}

libs/simdvec/src/main/java/org/elasticsearch/simdvec/internal/vectorization/DefaultESVectorUtilSupport.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,6 @@ public void centerAndCalculateOSQStatsDp(float[] target, float[] centroid, float
138138
stats[5] = centroidDot;
139139
}
140140

141-
@Override
142-
public float soarResidual(float[] v1, float[] centroid, float[] originalResidual) {
143-
assert v1.length == centroid.length;
144-
assert v1.length == originalResidual.length;
145-
float proj = 0;
146-
for (int i = 0; i < v1.length; i++) {
147-
float djk = v1[i] - centroid[i];
148-
proj = fma(djk, originalResidual[i], proj);
149-
}
150-
return proj;
151-
}
152-
153141
public static int ipByteBitImpl(byte[] q, byte[] d) {
154142
return ipByteBitImpl(q, d, 0);
155143
}

libs/simdvec/src/main/java/org/elasticsearch/simdvec/internal/vectorization/DefaultESVectorizationProvider.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
package org.elasticsearch.simdvec.internal.vectorization;
1111

1212
import org.apache.lucene.store.IndexInput;
13-
import org.elasticsearch.simdvec.ES91OSQVectorsScorer;
1413

1514
import java.io.IOException;
1615

libs/simdvec/src/main/java/org/elasticsearch/simdvec/ES91OSQVectorsScorer.java renamed to libs/simdvec/src/main/java/org/elasticsearch/simdvec/internal/vectorization/ES91OSQVectorsScorer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* your election, the "Elastic License 2.0", the "GNU Affero General Public
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
9-
package org.elasticsearch.simdvec;
9+
package org.elasticsearch.simdvec.internal.vectorization;
1010

1111
import org.apache.lucene.index.VectorSimilarityFunction;
1212
import org.apache.lucene.store.IndexInput;

libs/simdvec/src/main/java/org/elasticsearch/simdvec/internal/vectorization/ESVectorUtilSupport.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,4 @@ public interface ESVectorUtilSupport {
2828
void centerAndCalculateOSQStatsEuclidean(float[] target, float[] centroid, float[] centered, float[] stats);
2929

3030
void centerAndCalculateOSQStatsDp(float[] target, float[] centroid, float[] centered, float[] stats);
31-
32-
float soarResidual(float[] v1, float[] centroid, float[] originalResidual);
33-
3431
}

libs/simdvec/src/main/java/org/elasticsearch/simdvec/internal/vectorization/ESVectorizationProvider.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
package org.elasticsearch.simdvec.internal.vectorization;
1111

1212
import org.apache.lucene.store.IndexInput;
13-
import org.elasticsearch.simdvec.ES91OSQVectorsScorer;
1413

1514
import java.io.IOException;
1615
import java.util.Objects;

libs/simdvec/src/main21/java/org/elasticsearch/simdvec/internal/vectorization/ESVectorizationProvider.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.apache.lucene.util.Constants;
1414
import org.elasticsearch.logging.LogManager;
1515
import org.elasticsearch.logging.Logger;
16-
import org.elasticsearch.simdvec.ES91OSQVectorsScorer;
1716

1817
import java.io.IOException;
1918
import java.util.Locale;

0 commit comments

Comments
 (0)