Browse Source

Remove deprecated methods (#597)

Signed-off-by: yhmo <yihua.mo@zilliz.com>
groot 1 year ago
parent
commit
61297e92bf

+ 2 - 1
examples/main/java/io/milvus/GeneralExample.java

@@ -22,6 +22,7 @@ package io.milvus;
 import com.alibaba.fastjson.JSONObject;
 import com.google.protobuf.ByteString;
 import io.milvus.client.MilvusServiceClient;
+import io.milvus.common.clientenum.ConsistencyLevelEnum;
 import io.milvus.common.utils.JacksonUtils;
 import io.milvus.grpc.*;
 import io.milvus.param.*;
@@ -341,7 +342,7 @@ public class GeneralExample {
                 .withVectorFieldName(VECTOR_FIELD)
                 .withExpr(expr)
                 .withParams(SEARCH_PARAM)
-                .withGuaranteeTimestamp(Constant.GUARANTEE_EVENTUALLY_TS)
+                .withConsistencyLevel(ConsistencyLevelEnum.EVENTUALLY)
                 .build();
 
         R<SearchResults> response = milvusClient.search(searchParam);

+ 2 - 1
src/main/java/io/milvus/connection/QueryNodeListener.java

@@ -1,5 +1,6 @@
 package io.milvus.connection;
 
+import io.milvus.common.clientenum.ConsistencyLevelEnum;
 import io.milvus.grpc.SearchResults;
 import io.milvus.param.QueryNodeSingleSearch;
 import io.milvus.param.R;
@@ -32,7 +33,7 @@ public class QueryNodeListener implements Listener {
                 .withMetricType(singleSearch.getMetricType())
                 .withTopK(5)
                 .withRoundDecimal(-1)
-                .withGuaranteeTimestamp(1L)
+                .withConsistencyLevel(ConsistencyLevelEnum.EVENTUALLY)
                 .build();
     }
 

+ 0 - 53
src/main/java/io/milvus/param/dml/QueryParam.java

@@ -117,22 +117,6 @@ public class QueryParam {
             return this;
         }
 
-        /**
-         *  Graceful time for BOUNDED Consistency Level
-         *
-         * Note: This parameter is deprecated from Milvus v2.2.9, user only input consistency level to search.
-         *       The time settings of different consistency levels are determined by the server side.
-         *       For this reason, this method is marked as Deprecated in Java SDK v2.2.11
-         *
-         * @param gracefulTime graceful time
-         * @return <code>Builder</code>
-         */
-        @Deprecated
-        public Builder withGracefulTime(Long gracefulTime) {
-            this.gracefulTime = gracefulTime;
-            return this;
-        }
-
         /**
          * Adds a partition to specify query scope (Optional).
          *
@@ -182,43 +166,6 @@ public class QueryParam {
             return this;
         }
 
-        /**
-         * Specify an absolute timestamp in a query to get results based on a data view at a specified point in time.
-         * Default value is 0, server executes query on a full data view.
-         *
-         * @param ts a timestamp value
-         * @return <code>Builder</code>
-         */
-        @Deprecated
-        public Builder withTravelTimestamp(@NonNull Long ts) {
-            this.travelTimestamp = ts;
-            return this;
-        }
-
-        /**
-         * Instructs server to see insert/delete operations performed before a provided timestamp.
-         * If no such timestamp is specified, the server will wait for the latest operation to finish and query.
-         *
-         * Note: The timestamp is not an absolute timestamp, it is a hybrid value combined by UTC time and internal flags.
-         *  We call it TSO, for more information please refer to: https://github.com/milvus-io/milvus/blob/master/docs/design_docs/milvus_hybrid_ts_en.md
-         *  You can get a TSO from insert/delete operations, see the <code>MutationResultWrapper</code> class.
-         *  Use an operation's TSO to set this parameter, the server will execute query after this operation is finished.
-         *
-         * Default value is GUARANTEE_EVENTUALLY_TS, query executes query immediately.
-         *
-         * Note: This parameter is deprecated from Milvus v2.2.9, user only input consistency level to search.
-         *       The time settings of different consistency levels are determined by the server side.
-         *       For this reason, this method is marked as Deprecated in Java SDK v2.2.11
-         *
-         * @param ts a timestamp value
-         * @return <code>Builder</code>
-         */
-        @Deprecated
-        public Builder withGuaranteeTimestamp(@NonNull Long ts) {
-            this.guaranteeTimestamp = ts;
-            return this;
-        }
-
         /**
          * Specify a position to return results. Only take effect when the 'limit' value is specified.
          * Default value is 0, start from begin.

+ 0 - 53
src/main/java/io/milvus/param/dml/SearchParam.java

@@ -133,22 +133,6 @@ public class SearchParam {
             return this;
         }
 
-        /**
-         *  Graceful time for BOUNDED Consistency Level
-         *
-         * Note: This parameter is deprecated from Milvus v2.2.9, user only input consistency level to search.
-         *       The time settings of different consistency levels are determined by the server side.
-         *       For this reason, this method is marked as Deprecated in Java SDK v2.2.11
-         *
-         * @param gracefulTime graceful time
-         * @return <code>Builder</code>
-         */
-        @Deprecated
-        public Builder withGracefulTime(Long gracefulTime) {
-            this.gracefulTime = gracefulTime;
-            return this;
-        }
-
         /**
          * Adds a partition to specify search scope (Optional).
          *
@@ -270,43 +254,6 @@ public class SearchParam {
             return this;
         }
 
-        /**
-         * Specify an absolute timestamp in a search to get results based on a data view at a specified point in time.
-         * Default value is 0, server executes search on a full data view.
-         *
-         * @param ts a timestamp value
-         * @return <code>Builder</code>
-         */
-        @Deprecated
-        public Builder withTravelTimestamp(@NonNull Long ts) {
-            this.travelTimestamp = ts;
-            return this;
-        }
-
-        /**
-         * Instructs server to see insert/delete operations performed before a provided timestamp.
-         * If no such timestamp is specified, the server will wait for the latest operation to finish and search.
-         *
-         * Note: The timestamp is not an absolute timestamp, it is a hybrid value combined by UTC time and internal flags.
-         *  We call it TSO, for more information please refer to: https://github.com/milvus-io/milvus/blob/master/docs/design_docs/milvus_hybrid_ts_en.md
-         *  You can get a TSO from insert/delete operations, see the <code>MutationResultWrapper</code> class.
-         *  Use an operation's TSO to set this parameter, the server will execute search after this operation is finished.
-         *
-         * Default value is GUARANTEE_EVENTUALLY_TS, server executes search immediately.
-         *
-         * Note: This parameter is deprecated from Milvus v2.2.9, user only input consistency level to search.
-         *       The time settings of different consistency levels are determined by the server side.
-         *       For this reason, this method is marked as Deprecated in Java SDK v2.2.11
-         *
-         * @param ts a timestamp value
-         * @return <code>Builder</code>
-         */
-        @Deprecated
-        public Builder withGuaranteeTimestamp(@NonNull Long ts) {
-            this.guaranteeTimestamp = ts;
-            return this;
-        }
-
         /**
          * Ignore the growing segments to get best search performance. Default is False.
          * For the user case that don't require data visibility.

+ 0 - 12
src/main/java/io/milvus/param/highlevel/dml/QuerySimpleParam.java

@@ -82,18 +82,6 @@ public class QuerySimpleParam {
             return this;
         }
 
-        /**
-         * Specifies output fields (Optional).
-         *
-         * @param outFields output fields
-         * @return <code>Builder</code>
-         */
-        @Deprecated
-        public Builder withOutFields(@NonNull List<String> outFields) {
-            this.outputFields.addAll(outFields);
-            return this;
-        }
-
         /**
          * Specifies output fields (Optional).
          *

+ 0 - 13
src/main/java/io/milvus/param/highlevel/dml/SearchSimpleParam.java

@@ -142,19 +142,6 @@ public class SearchSimpleParam {
             return this;
         }
 
-        /**
-         * Specify a value to control the returned number of entities. Must be a positive value.
-         * Default value is 10, will return without limit.
-         *
-         * @param limit a value to define the limit of returned entities
-         * @return <code>Builder</code>
-         */
-        @Deprecated
-        public Builder withLimit(int limit) {
-            this.limit = limit;
-            return this;
-        }
-
         /**
          * Specify a value to control the returned number of entities. Must be a positive value.
          * Default value is 10, will return without limit.

+ 3 - 56
src/test/java/io/milvus/client/MilvusServiceClientTest.java

@@ -21,6 +21,7 @@ package io.milvus.client;
 
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.protobuf.ByteString;
+import io.milvus.common.clientenum.ConsistencyLevelEnum;
 import io.milvus.exception.IllegalResponseException;
 import io.milvus.exception.ParamException;
 import io.milvus.grpc.*;
@@ -1957,38 +1958,6 @@ class MilvusServiceClientTest {
                 .build()
         );
 
-        // travel timestamp must be greater than 0
-        assertThrows(ParamException.class, () -> SearchParam.newBuilder()
-                .withCollectionName("collection1")
-                .withPartitionNames(partitions)
-                .addPartitionName("p2")
-                .withParams("{}")
-                .withOutFields(outputFields)
-                .withVectorFieldName("field1")
-                .withMetricType(MetricType.IP)
-                .withTopK(5)
-                .withVectors(vectors)
-                .withExpr("dummy")
-                .withTravelTimestamp(-1L)
-                .build()
-        );
-
-        // guarantee timestamp must be greater than 0
-        assertThrows(ParamException.class, () -> SearchParam.newBuilder()
-                .withCollectionName("collection1")
-                .withPartitionNames(partitions)
-                .addPartitionName("p2")
-                .withParams("{}")
-                .withOutFields(outputFields)
-                .withVectorFieldName("field1")
-                .withMetricType(MetricType.IP)
-                .withTopK(5)
-                .withVectors(vectors)
-                .withExpr("dummy")
-                .withGuaranteeTimestamp(-1L)
-                .build()
-        );
-
         // collection name is empty
         List<Float> vector1 = Collections.singletonList(0.1F);
         vectors.add(vector1);
@@ -2207,8 +2176,7 @@ class MilvusServiceClientTest {
                 .withVectors(vectors)
                 .withExpr("dummy")
                 .withRoundDecimal(5)
-                .withTravelTimestamp(1L)
-                .withGuaranteeTimestamp(1L)
+                .withConsistencyLevel(ConsistencyLevelEnum.EVENTUALLY)
                 .build();
         testFuncByName("search", param);
 
@@ -2250,26 +2218,6 @@ class MilvusServiceClientTest {
                 .build()
         );
 
-        // negative travel time stamp
-        assertThrows(ParamException.class, () -> QueryParam.newBuilder()
-                .withCollectionName("collection1")
-                .withPartitionNames(partitions)
-                .withOutFields(outputFields)
-                .withExpr("dummy")
-                .withTravelTimestamp(-1L)
-                .build()
-        );
-
-        // negative guarantee time stamp
-        assertThrows(ParamException.class, () -> QueryParam.newBuilder()
-                .withCollectionName("collection1")
-                .withPartitionNames(partitions)
-                .withOutFields(outputFields)
-                .withExpr("dummy")
-                .withGuaranteeTimestamp(-1L)
-                .build()
-        );
-
         // negative topk
         assertThrows(ParamException.class, () -> QueryParam.newBuilder()
                 .withCollectionName("collection1")
@@ -2313,8 +2261,7 @@ class MilvusServiceClientTest {
                 .withOutFields(outputFields)
                 .addOutField("d1")
                 .withExpr("dummy")
-                .withTravelTimestamp(0L)
-                .withGuaranteeTimestamp(1L)
+                .withConsistencyLevel(ConsistencyLevelEnum.EVENTUALLY)
                 .build();
 
         testFuncByName("query", param);