Sfoglia il codice sorgente

Fix typo (#244)

Signed-off-by: yhmo <yihua.mo@zilliz.com>
groot 3 anni fa
parent
commit
4d6fb11700

+ 6 - 5
src/main/java/io/milvus/Response/FieldDataWrapper.java

@@ -88,14 +88,15 @@ public class FieldDataWrapper {
 
     /**
      * Returns the field data according to its type:
-     *      float vector field return List<List<Float>>
-     *      binary vector field return List<ByteBuffer>
-     *      int64 field return List<Long>
-     *      boolean field return List<Boolean>
+     *      float vector field return List&lt;List&lt;Float&gt;&gt;,
+     *      binary vector field return List&lt;ByteBuffer&gt;,
+     *      int64 field return List&lt;Long&gt;,
+     *      boolean field return List&lt;Boolean&gt;,
+     *      etc.
      *
      * Throws {@link IllegalResponseException} if the field type is illegal.
      *
-     * @return <code>List<?></?></code>
+     * @return <code>List</code>
      */
     public List<?> getFieldData() throws IllegalResponseException {
         DataType dt = fieldData.getType();

+ 1 - 1
src/main/java/io/milvus/param/collection/CreateCollectionParam.java

@@ -129,7 +129,7 @@ public class CreateCollectionParam {
                 throw new ParamException("ShardNum must be larger than 0");
             }
 
-            if (fieldTypes == null || fieldTypes.isEmpty()) {
+            if (fieldTypes.isEmpty()) {
                 throw new ParamException("Field numbers must be larger than 0");
             }
 

+ 1 - 1
src/main/java/io/milvus/param/collection/FieldType.java

@@ -53,7 +53,7 @@ public class FieldType {
 
     public int getDimension() {
         if (typeParams.containsKey(Constant.VECTOR_DIM)) {
-            return Integer.valueOf(typeParams.get(Constant.VECTOR_DIM));
+            return Integer.parseInt(typeParams.get(Constant.VECTOR_DIM));
         }
 
         return 0;

+ 1 - 1
src/main/java/io/milvus/param/collection/FlushParam.java

@@ -82,7 +82,7 @@ public class FlushParam {
          *
          * If sync mode disabled, client returns at once after the flush() is called.
          *
-         * @param syncFlush <code>Boolean.TRUE</code> is sync mode, Bollean.FALSE is not
+         * @param syncFlush <code>Boolean.TRUE</code> is sync mode, <code>Boolean.FALSE</code> is not
          * @return <code>Builder</code>
          */
         public Builder withSyncFlush(@NonNull Boolean syncFlush) {

+ 0 - 1
src/main/java/io/milvus/param/control/ManualCompactionParam.java

@@ -2,7 +2,6 @@ package io.milvus.param.control;
 
 import io.milvus.exception.ParamException;
 import io.milvus.param.ParamUtils;
-import io.milvus.param.collection.DropCollectionParam;
 import lombok.Getter;
 import lombok.NonNull;
 

+ 18 - 4
src/main/java/io/milvus/param/dml/InsertParam.java

@@ -23,7 +23,6 @@ import io.milvus.exception.ParamException;
 import io.milvus.grpc.DataType;
 import io.milvus.param.ParamUtils;
 
-import io.milvus.param.partition.LoadPartitionsParam;
 import lombok.Getter;
 import lombok.NonNull;
 import java.nio.ByteBuffer;
@@ -237,9 +236,9 @@ public class InsertParam {
 
     /**
      * Internal class for insert data.
-     * if dataType is scalar(bool/int/float/double): values is List<Integer>, List<Long>...
-     * if dataType is FloatVector: values is List<List<Float>>
-     * if dataType is BinaryVector: values is List<ByteBuffer>
+     * If dataType is scalar(bool/int/float/double), values is List&lt;Integer&gt;, List&lt;Long&gt;, etc.
+     * If dataType is FloatVector, values is List&lt;Float&gt;.
+     * If dataType is BinaryVector, values is List&lt;ByteBuffer&gt;.
      */
     public static class Field {
         private final String name;
@@ -252,14 +251,29 @@ public class InsertParam {
             this.values = values;
         }
 
+        /**
+         * Return name of the field.
+         *
+         * @return <code>String</code>
+         */
         public String getName() {
             return name;
         }
 
+        /**
+         * Return data type of the field.
+         *
+         * @return <code>String</code>
+         */
         public DataType getType() {
             return type;
         }
 
+        /**
+         * Return data of the field, in column-base.
+         *
+         * @return <code>List</code>
+         */
         public List<?> getValues() {
             return values;
         }

+ 3 - 4
src/main/java/io/milvus/param/dml/QueryParam.java

@@ -22,10 +22,9 @@ package io.milvus.param.dml;
 import com.google.common.collect.Lists;
 import io.milvus.exception.ParamException;
 import io.milvus.param.ParamUtils;
-
-import io.milvus.param.partition.LoadPartitionsParam;
 import lombok.Getter;
 import lombok.NonNull;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -55,8 +54,8 @@ public class QueryParam {
      */
     public static class Builder {
         private String collectionName;
-        private List<String> partitionNames = Lists.newArrayList();
-        private List<String> outFields = new ArrayList<>();
+        private final List<String> partitionNames = Lists.newArrayList();
+        private final List<String> outFields = new ArrayList<>();
         private String expr = "";
 
         private Builder() {

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

@@ -68,7 +68,7 @@ public class SearchParam {
      */
     public static class Builder {
         private String collectionName;
-        private List<String> partitionNames = Lists.newArrayList();
+        private final List<String> partitionNames = Lists.newArrayList();
         private MetricType metricType = MetricType.L2;
         private String vectorFieldName;
         private Integer topK;
@@ -188,9 +188,9 @@ public class SearchParam {
         /**
          * Sets the target vectors.
          *
-         * @param vectors list of target vectors
-         *                If vector type is FloatVector: vectors is List<List<Float>>
-         *                If vector type is BinaryVector: vectors is List<ByteBuffer>
+         * @param vectors list of target vectors:
+         *                if vector type is FloatVector, vectors is List&lt;List&lt;Float&gt;&gt;;
+         *                if vector type is BinaryVector, vectors is List&lt;ByteBuffer&gt;;
          * @return <code>Builder</code>
          */
         public Builder withVectors(@NonNull List<?> vectors) {

+ 2 - 2
src/main/java/io/milvus/param/index/CreateIndexParam.java

@@ -202,9 +202,9 @@ public class CreateIndexParam {
             if (syncMode == Boolean.TRUE) {
                 if (syncWaitingInterval <= 0) {
                     throw new ParamException("Sync index waiting interval must be larger than zero");
-                } else if (syncWaitingInterval > Constant.MAX_WAITING_LOADING_INTERVAL) {
+                } else if (syncWaitingInterval > Constant.MAX_WAITING_INDEX_INTERVAL) {
                     throw new ParamException("Sync index waiting interval cannot be larger than "
-                            + Constant.MAX_WAITING_LOADING_INTERVAL.toString() + " milliseconds");
+                            + Constant.MAX_WAITING_INDEX_INTERVAL.toString() + " milliseconds");
                 }
 
                 if (syncWaitingTimeout <= 0) {

+ 1 - 1
src/main/java/io/milvus/param/partition/ShowPartitionsParam.java

@@ -52,7 +52,7 @@ public class ShowPartitionsParam {
      */
     public static final class Builder {
         private String collectionName;
-        private List<String> partitionNames = new ArrayList<>();
+        private final List<String> partitionNames = new ArrayList<>();
 
         // showType:
         //   default showType = ShowType.All

+ 5 - 2
src/test/java/io/milvus/client/MilvusServiceClientTest.java

@@ -1445,11 +1445,12 @@ class MilvusServiceClientTest {
     void searchParam() {
         // test throw exception with illegal input
         List<String> partitions = Collections.singletonList("partition1");
-        List<String> outputFields = Collections.singletonList("field2");
+        List<String> outputFields = Collections.singletonList("field1");
         List<List<Float>> vectors = new ArrayList<>();
         assertThrows(ParamException.class, () -> SearchParam.newBuilder()
                 .withCollectionName("collection1")
                 .withPartitionNames(partitions)
+                .addPartitionName("p2")
                 .withParams("dummy")
                 .withOutFields(outputFields)
                 .withVectorFieldName("field1")
@@ -1644,11 +1645,13 @@ class MilvusServiceClientTest {
     void queryParam() {
         // test throw exception with illegal input
         List<String> partitions = Collections.singletonList("partition1");
-        List<String> outputFields = Collections.singletonList("field2");
+        List<String> outputFields = Collections.singletonList("field1");
         assertThrows(ParamException.class, () -> QueryParam.newBuilder()
                 .withCollectionName("")
                 .withPartitionNames(partitions)
+                .addPartitionName("p2")
                 .withOutFields(outputFields)
+                .addOutField("f2")
                 .withExpr("dummy")
                 .build()
         );