diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 84b4f09f9..c807e348e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -20,7 +20,7 @@ jobs: Build-k-NN-Linux: strategy: matrix: - java: [11, 17] + java: [11, 17, 21] name: Build and Test k-NN Plugin on Linux runs-on: ubuntu-latest @@ -57,7 +57,7 @@ jobs: Build-k-NN-MacOS: strategy: matrix: - java: [ 11, 17 ] + java: [ 11, 17, 21 ] name: Build and Test k-NN Plugin on MacOS needs: Get-CI-Image-Tag @@ -84,7 +84,7 @@ jobs: Build-k-NN-Windows: strategy: matrix: - java: [ 11, 17 ] + java: [ 11, 17, 21 ] name: Build and Test k-NN Plugin on Windows needs: Get-CI-Image-Tag diff --git a/.github/workflows/test_security.yml b/.github/workflows/test_security.yml index 3813ff675..ff3ca1459 100644 --- a/.github/workflows/test_security.yml +++ b/.github/workflows/test_security.yml @@ -15,7 +15,7 @@ jobs: Build-ad: strategy: matrix: - java: [ 11,17 ] + java: [ 11,17,21 ] os: [ubuntu-latest] fail-fast: true diff --git a/build.gradle b/build.gradle index f3dcff3e3..fb56692ce 100644 --- a/build.gradle +++ b/build.gradle @@ -36,7 +36,7 @@ plugins { id 'java-library' id 'java-test-fixtures' id 'idea' - id "com.diffplug.spotless" version "6.3.0" apply false + id "com.diffplug.spotless" version "6.20.0" apply false id 'io.freefair.lombok' version '8.4' } diff --git a/src/main/java/org/opensearch/knn/indices/ModelDao.java b/src/main/java/org/opensearch/knn/indices/ModelDao.java index fe0deb1cf..eada08b44 100644 --- a/src/main/java/org/opensearch/knn/indices/ModelDao.java +++ b/src/main/java/org/opensearch/knn/indices/ModelDao.java @@ -654,7 +654,9 @@ private void removeModelIdFromGraveyardOnFailure(String modelId, Exception excep client.execute( UpdateModelGraveyardAction.INSTANCE, new UpdateModelGraveyardRequest(modelId, true), - ActionListener.wrap(acknowledgedResponse -> { throw exceptionFromPreviousStep; }, unblockingFailedException -> { + ActionListener.wrap(acknowledgedResponse -> { + throw exceptionFromPreviousStep; + }, unblockingFailedException -> { // If it fails to remove the modelId from Model Graveyard, then log the error message and // throw the exception that was passed as a parameter from previous step String errorMessage = String.format("Failed to remove \" %s \" from Model Graveyard", modelId); diff --git a/src/main/java/org/opensearch/knn/plugin/transport/KNNWarmupResponse.java b/src/main/java/org/opensearch/knn/plugin/transport/KNNWarmupResponse.java index f13fbd3db..d9e607db2 100644 --- a/src/main/java/org/opensearch/knn/plugin/transport/KNNWarmupResponse.java +++ b/src/main/java/org/opensearch/knn/plugin/transport/KNNWarmupResponse.java @@ -5,7 +5,7 @@ package org.opensearch.knn.plugin.transport; -import org.opensearch.core.action.support.DefaultShardOperationFailedException;; +import org.opensearch.core.action.support.DefaultShardOperationFailedException; import org.opensearch.action.support.broadcast.BroadcastResponse; import org.opensearch.core.common.io.stream.StreamInput; import org.opensearch.core.xcontent.ToXContentObject; diff --git a/src/main/java/org/opensearch/knn/plugin/transport/KNNWarmupTransportAction.java b/src/main/java/org/opensearch/knn/plugin/transport/KNNWarmupTransportAction.java index c55c9b619..a738527ff 100644 --- a/src/main/java/org/opensearch/knn/plugin/transport/KNNWarmupTransportAction.java +++ b/src/main/java/org/opensearch/knn/plugin/transport/KNNWarmupTransportAction.java @@ -9,7 +9,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.opensearch.action.support.ActionFilters; -import org.opensearch.core.action.support.DefaultShardOperationFailedException;; +import org.opensearch.core.action.support.DefaultShardOperationFailedException; import org.opensearch.action.support.broadcast.node.TransportBroadcastByNodeAction; import org.opensearch.cluster.ClusterState; import org.opensearch.cluster.block.ClusterBlockException; diff --git a/src/testFixtures/java/org/opensearch/knn/TestUtils.java b/src/testFixtures/java/org/opensearch/knn/TestUtils.java index a9721ce14..61c0abe4f 100644 --- a/src/testFixtures/java/org/opensearch/knn/TestUtils.java +++ b/src/testFixtures/java/org/opensearch/knn/TestUtils.java @@ -208,12 +208,9 @@ public static PriorityQueue computeGroundTruthValues(int k, SpaceTyp public static float computeDistFromSpaceType(SpaceType spaceType, float[] indexVector, float[] queryVector) { float dist; if (spaceType != null) { - dist = KNN_SCORING_SPACE_TYPE.getOrDefault( - spaceType, - (defaultQueryVector, defaultIndexVector) -> { - throw new IllegalArgumentException(String.format("Invalid SpaceType function: \"%s\"", spaceType)); - } - ).apply(queryVector, indexVector); + dist = KNN_SCORING_SPACE_TYPE.getOrDefault(spaceType, (defaultQueryVector, defaultIndexVector) -> { + throw new IllegalArgumentException(String.format("Invalid SpaceType function: \"%s\"", spaceType)); + }).apply(queryVector, indexVector); } else { throw new NullPointerException("SpaceType is null. Provide a valid SpaceType."); }