Fix randomly failing field info format tests (#12473)

This commit is contained in:
Benjamin Trent 2023-08-02 14:10:57 -04:00 committed by GitHub
parent 5e725964a0
commit 229dc7481e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -354,7 +354,7 @@ public abstract class BaseFieldInfoFormatTestCase extends BaseIndexFileFormatTes
type.setDimensions(dimension, indexDimension, dimensionNumBytes); type.setDimensions(dimension, indexDimension, dimensionNumBytes);
} }
if (r.nextBoolean()) { if (r.nextBoolean() && getVectorsMaxDimensions(fieldName) > 0) {
int dimension = 1 + r.nextInt(getVectorsMaxDimensions(fieldName)); int dimension = 1 + r.nextInt(getVectorsMaxDimensions(fieldName));
VectorSimilarityFunction similarityFunction = VectorSimilarityFunction similarityFunction =
RandomPicks.randomFrom(r, VectorSimilarityFunction.values()); RandomPicks.randomFrom(r, VectorSimilarityFunction.values());