From d96725bc9a53ec31d259b6e0f36c4889b28c16b0 Mon Sep 17 00:00:00 2001 From: Sahil Buddharaju Date: Thu, 12 Dec 2024 13:48:12 -0800 Subject: [PATCH] spotlessApply Signed-off-by: Sahil Buddharaju --- .../org/opensearch/knn/bwc/IndexingIT.java | 60 ++++++++----------- .../org/opensearch/knn/bwc/IndexingIT.java | 39 +++++++----- 2 files changed, 47 insertions(+), 52 deletions(-) diff --git a/qa/restart-upgrade/src/test/java/org/opensearch/knn/bwc/IndexingIT.java b/qa/restart-upgrade/src/test/java/org/opensearch/knn/bwc/IndexingIT.java index 9f84e4f32..08597ac04 100644 --- a/qa/restart-upgrade/src/test/java/org/opensearch/knn/bwc/IndexingIT.java +++ b/qa/restart-upgrade/src/test/java/org/opensearch/knn/bwc/IndexingIT.java @@ -37,10 +37,7 @@ import static org.opensearch.knn.common.KNNConstants.METHOD_PARAMETER_M; import static org.opensearch.knn.common.KNNConstants.METHOD_PARAMETER_SPACE_TYPE; import static org.opensearch.knn.common.KNNConstants.METHOD_ENCODER_PARAMETER; -import static org.opensearch.knn.common.KNNConstants.VECTOR_DATA_TYPE_FIELD; import static org.opensearch.knn.common.KNNConstants.ENCODER_SQ; -import static org.opensearch.knn.common.KNNConstants.LUCENE_SQ_BITS; -import static org.opensearch.knn.common.KNNConstants.LUCENE_SQ_CONFIDENCE_INTERVAL; import static org.opensearch.knn.common.KNNConstants.NAME; import static org.opensearch.knn.common.KNNConstants.PARAMETERS; @@ -140,17 +137,9 @@ public void testKNNIndexLuceneByteVector() throws Exception { if (isRunningAgainstOldCluster()) { createKnnIndex( - testIndex, - getKNNDefaultIndexSettings(), - createKnnIndexMapping( - TEST_FIELD, - DIMENSIONS, - METHOD_HNSW, - LUCENE_NAME, - SpaceType.L2.getValue(), - true, - VectorDataType.BYTE - ) + testIndex, + getKNNDefaultIndexSettings(), + createKnnIndexMapping(TEST_FIELD, DIMENSIONS, METHOD_HNSW, LUCENE_NAME, SpaceType.L2.getValue(), true, VectorDataType.BYTE) ); addKNNByteDocs(testIndex, TEST_FIELD, DIMENSIONS, DOC_ID, 50); // Flush to ensure that index is not re-indexed when node comes back up @@ -164,7 +153,6 @@ public void testKNNIndexLuceneByteVector() throws Exception { } } - public void testKNNIndexLuceneQuantization() throws Exception { waitForClusterHealthGreen(NODES_BWC_CLUSTER); int k = 4; @@ -172,27 +160,27 @@ public void testKNNIndexLuceneQuantization() throws Exception { if (isRunningAgainstOldCluster()) { String mapping = XContentFactory.jsonBuilder() - .startObject() - .startObject("properties") - .startObject(TEST_FIELD) - .field(VECTOR_TYPE, KNN_VECTOR) - .field(DIMENSION, dimension) - .startObject(KNN_METHOD) - .field(NAME, METHOD_HNSW) - .field(METHOD_PARAMETER_SPACE_TYPE, SpaceType.INNER_PRODUCT.getValue()) - .field(KNN_ENGINE, LUCENE_NAME) - .startObject(PARAMETERS) - .startObject(METHOD_ENCODER_PARAMETER) - .field(NAME, ENCODER_SQ) - .endObject() - .field(METHOD_PARAMETER_EF_CONSTRUCTION, 256) - .field(METHOD_PARAMETER_M, 16) - .endObject() - .endObject() - .endObject() - .endObject() - .endObject() - .toString(); + .startObject() + .startObject("properties") + .startObject(TEST_FIELD) + .field(VECTOR_TYPE, KNN_VECTOR) + .field(DIMENSION, dimension) + .startObject(KNN_METHOD) + .field(NAME, METHOD_HNSW) + .field(METHOD_PARAMETER_SPACE_TYPE, SpaceType.INNER_PRODUCT.getValue()) + .field(KNN_ENGINE, LUCENE_NAME) + .startObject(PARAMETERS) + .startObject(METHOD_ENCODER_PARAMETER) + .field(NAME, ENCODER_SQ) + .endObject() + .field(METHOD_PARAMETER_EF_CONSTRUCTION, 256) + .field(METHOD_PARAMETER_M, 16) + .endObject() + .endObject() + .endObject() + .endObject() + .endObject() + .toString(); createKnnIndex(testIndex, getKNNDefaultIndexSettings(), mapping); Float[] vector1 = { -10.6f, 25.48f }; diff --git a/qa/rolling-upgrade/src/test/java/org/opensearch/knn/bwc/IndexingIT.java b/qa/rolling-upgrade/src/test/java/org/opensearch/knn/bwc/IndexingIT.java index bd46886ab..d0ee16c99 100644 --- a/qa/rolling-upgrade/src/test/java/org/opensearch/knn/bwc/IndexingIT.java +++ b/qa/rolling-upgrade/src/test/java/org/opensearch/knn/bwc/IndexingIT.java @@ -18,7 +18,6 @@ public class IndexingIT extends AbstractRollingUpgradeTestCase { private static final String FAISS_NAME = "faiss"; private static final String LUCENE_NAME = "lucene"; - public void testKNNDefaultIndexSettings() throws Exception { waitForClusterHealthGreen(NODES_BWC_CLUSTER); switch (getClusterType()) { @@ -101,24 +100,28 @@ public void testKNNIndexCreation_withMethodMapper() throws Exception { if (isFirstMixedRound()) { docIdOld = 0; createKnnIndex( - firstMixRoundIndex, - getKNNDefaultIndexSettings(), - createKnnIndexMapping(TEST_FIELD, DIMENSIONS, ALGO, FAISS_NAME) + firstMixRoundIndex, + getKNNDefaultIndexSettings(), + createKnnIndexMapping(TEST_FIELD, DIMENSIONS, ALGO, FAISS_NAME) ); addKNNDocs(firstMixRoundIndex, TEST_FIELD, DIMENSIONS, docIdOld, NUM_DOCS); } else { docIdOld = 0; createKnnIndex( - otherMixRoundIndex, - getKNNDefaultIndexSettings(), - createKnnIndexMapping(TEST_FIELD, DIMENSIONS, ALGO, FAISS_NAME) + otherMixRoundIndex, + getKNNDefaultIndexSettings(), + createKnnIndexMapping(TEST_FIELD, DIMENSIONS, ALGO, FAISS_NAME) ); addKNNDocs(otherMixRoundIndex, TEST_FIELD, DIMENSIONS, docIdOld, NUM_DOCS); } break; case UPGRADED: docIdOld = 0; - createKnnIndex(upgradedIndex, getKNNDefaultIndexSettings(), createKnnIndexMapping(TEST_FIELD, DIMENSIONS, ALGO, FAISS_NAME)); + createKnnIndex( + upgradedIndex, + getKNNDefaultIndexSettings(), + createKnnIndexMapping(TEST_FIELD, DIMENSIONS, ALGO, FAISS_NAME) + ); addKNNDocs(upgradedIndex, TEST_FIELD, DIMENSIONS, docIdOld, NUM_DOCS); deleteKNNIndex(testIndex); @@ -143,24 +146,28 @@ public void testKNNLuceneIndexCreation_withMethodMapper() throws Exception { if (isFirstMixedRound()) { docIdOld = 0; createKnnIndex( - firstMixRoundIndex, - getKNNDefaultIndexSettings(), - createKnnIndexMapping(TEST_FIELD, DIMENSIONS, ALGO, LUCENE_NAME) + firstMixRoundIndex, + getKNNDefaultIndexSettings(), + createKnnIndexMapping(TEST_FIELD, DIMENSIONS, ALGO, LUCENE_NAME) ); addKNNDocs(firstMixRoundIndex, TEST_FIELD, DIMENSIONS, docIdOld, NUM_DOCS); } else { docIdOld = 0; createKnnIndex( - otherMixRoundIndex, - getKNNDefaultIndexSettings(), - createKnnIndexMapping(TEST_FIELD, DIMENSIONS, ALGO, LUCENE_NAME) + otherMixRoundIndex, + getKNNDefaultIndexSettings(), + createKnnIndexMapping(TEST_FIELD, DIMENSIONS, ALGO, LUCENE_NAME) ); addKNNDocs(otherMixRoundIndex, TEST_FIELD, DIMENSIONS, docIdOld, NUM_DOCS); } break; case UPGRADED: docIdOld = 0; - createKnnIndex(upgradedIndex, getKNNDefaultIndexSettings(), createKnnIndexMapping(TEST_FIELD, DIMENSIONS, ALGO, LUCENE_NAME)); + createKnnIndex( + upgradedIndex, + getKNNDefaultIndexSettings(), + createKnnIndexMapping(TEST_FIELD, DIMENSIONS, ALGO, LUCENE_NAME) + ); addKNNDocs(upgradedIndex, TEST_FIELD, DIMENSIONS, docIdOld, NUM_DOCS); deleteKNNIndex(testIndex); @@ -178,4 +185,4 @@ public void validateKNNIndexingOnUpgrade(int totalDocsCount, int docId) throws E totalDocsCount = totalDocsCount + NUM_DOCS; validateKNNSearch(testIndex, TEST_FIELD, DIMENSIONS, totalDocsCount, K); } -} \ No newline at end of file +}