LUCENE-10408 Test correction checksum (#734)

Use double instead of float to test vector values checksum
This commit is contained in:
Mayya Sharipova 2022-03-09 08:02:40 +00:00 committed by GitHub
parent 8afec33e74
commit e5717cddfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -594,7 +594,7 @@ public abstract class BaseKnnVectorsFormatTestCase extends BaseIndexFileFormatTe
int numDocs = atLeast(1000); int numDocs = atLeast(1000);
int numFields = TestUtil.nextInt(random(), 1, 10); int numFields = TestUtil.nextInt(random(), 1, 10);
int[] fieldDocCounts = new int[numFields]; int[] fieldDocCounts = new int[numFields];
float[] fieldTotals = new float[numFields]; double[] fieldTotals = new double[numFields];
int[] fieldDims = new int[numFields]; int[] fieldDims = new int[numFields];
VectorSimilarityFunction[] fieldSearchStrategies = new VectorSimilarityFunction[numFields]; VectorSimilarityFunction[] fieldSearchStrategies = new VectorSimilarityFunction[numFields];
for (int i = 0; i < numFields; i++) { for (int i = 0; i < numFields; i++) {
@ -622,7 +622,7 @@ public abstract class BaseKnnVectorsFormatTestCase extends BaseIndexFileFormatTe
try (IndexReader r = w.getReader()) { try (IndexReader r = w.getReader()) {
for (int field = 0; field < numFields; field++) { for (int field = 0; field < numFields; field++) {
int docCount = 0; int docCount = 0;
float checksum = 0; double checksum = 0;
String fieldName = "int" + field; String fieldName = "int" + field;
for (LeafReaderContext ctx : r.leaves()) { for (LeafReaderContext ctx : r.leaves()) {
VectorValues vectors = ctx.reader().getVectorValues(fieldName); VectorValues vectors = ctx.reader().getVectorValues(fieldName);
@ -1095,7 +1095,7 @@ public abstract class BaseKnnVectorsFormatTestCase extends BaseIndexFileFormatTe
VectorSimilarityFunction.values()[ VectorSimilarityFunction.values()[
random().nextInt(VectorSimilarityFunction.values().length)]; random().nextInt(VectorSimilarityFunction.values().length)];
float fieldValuesCheckSum = 0f; double fieldValuesCheckSum = 0;
int fieldDocCount = 0; int fieldDocCount = 0;
long fieldSumDocIDs = 0; long fieldSumDocIDs = 0;
@ -1120,7 +1120,7 @@ public abstract class BaseKnnVectorsFormatTestCase extends BaseIndexFileFormatTe
} }
try (IndexReader r = w.getReader()) { try (IndexReader r = w.getReader()) {
float checksum = 0; double checksum = 0;
int docCount = 0; int docCount = 0;
long sumDocIds = 0; long sumDocIds = 0;
for (LeafReaderContext ctx : r.leaves()) { for (LeafReaderContext ctx : r.leaves()) {