Browse Source

pretty code style for newest branch (#211)

* pretty code style for newest branch

Signed-off-by: ChunelFeng <chunel@foxmail.com>

* pretty example code style ...

Signed-off-by: ChunelFeng <chunel@foxmail.com>
Chunel 3 years ago
parent
commit
a5614fcc66

+ 44 - 25
examples/main/io/milvus/DDLExample.java

@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package io.milvus;
 package io.milvus;
 
 
 import io.milvus.client.MilvusServiceClient;
 import io.milvus.client.MilvusServiceClient;
@@ -58,7 +77,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void createCollection(){
+    public void createCollection() {
         FieldType[] fieldTypes = new FieldType[2];
         FieldType[] fieldTypes = new FieldType[2];
         FieldType fieldType1 = FieldType.Builder.newBuilder()
         FieldType fieldType1 = FieldType.Builder.newBuilder()
                 .withName("userID")
                 .withName("userID")
@@ -67,8 +86,8 @@ public class DDLExample {
                 .withAutoID(true)
                 .withAutoID(true)
                 .withPrimaryKey(true).build();
                 .withPrimaryKey(true).build();
 
 
-        Map<String,String> typeParamsMap = new HashMap<>();
-        typeParamsMap.put("dim","512");
+        Map<String, String> typeParamsMap = new HashMap<>();
+        typeParamsMap.put("dim", "512");
         FieldType fieldType2 = FieldType.Builder.newBuilder()
         FieldType fieldType2 = FieldType.Builder.newBuilder()
                 .withName("vector1")
                 .withName("vector1")
                 .withDescription("match Vector")
                 .withDescription("match Vector")
@@ -88,7 +107,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void dropCollection(){
+    public void dropCollection() {
         R<RpcStatus> dropCollection = milvusClient.dropCollection(DropCollectionParam.Builder
         R<RpcStatus> dropCollection = milvusClient.dropCollection(DropCollectionParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")
@@ -97,7 +116,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void hasCollection(){
+    public void hasCollection() {
         R<Boolean> hasCollection = milvusClient.hasCollection(HasCollectionParam.Builder
         R<Boolean> hasCollection = milvusClient.hasCollection(HasCollectionParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")
@@ -107,7 +126,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void loadCollection(){
+    public void loadCollection() {
         R<RpcStatus> loadCollection = milvusClient.loadCollection(LoadCollectionParam.Builder
         R<RpcStatus> loadCollection = milvusClient.loadCollection(LoadCollectionParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")
@@ -116,7 +135,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void releaseCollection(){
+    public void releaseCollection() {
         R<RpcStatus> releaseCollection = milvusClient.releaseCollection(ReleaseCollectionParam.Builder
         R<RpcStatus> releaseCollection = milvusClient.releaseCollection(ReleaseCollectionParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")
@@ -125,7 +144,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void describeCollection(){
+    public void describeCollection() {
         R<DescribeCollectionResponse> describeCollection = milvusClient.describeCollection(DescribeCollectionParam.Builder
         R<DescribeCollectionResponse> describeCollection = milvusClient.describeCollection(DescribeCollectionParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")
@@ -134,7 +153,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void getCollectionStatistics(){
+    public void getCollectionStatistics() {
         R<GetCollectionStatisticsResponse> getCollectionStatistics = milvusClient.getCollectionStatistics(GetCollectionStatisticsParam.Builder
         R<GetCollectionStatisticsResponse> getCollectionStatistics = milvusClient.getCollectionStatistics(GetCollectionStatisticsParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")
@@ -143,7 +162,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void showCollections(){
+    public void showCollections() {
         String[] collectionNames = new String[]{"collection1"};
         String[] collectionNames = new String[]{"collection1"};
         R<ShowCollectionsResponse> showCollections = milvusClient.showCollections(ShowCollectionParam.Builder
         R<ShowCollectionsResponse> showCollections = milvusClient.showCollections(ShowCollectionParam.Builder
                 .newBuilder()
                 .newBuilder()
@@ -154,7 +173,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void createPartition(){
+    public void createPartition() {
         R<RpcStatus> createPartition = milvusClient.createPartition(CreatePartitionParam.Builder
         R<RpcStatus> createPartition = milvusClient.createPartition(CreatePartitionParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")
@@ -165,7 +184,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void dropPartition(){
+    public void dropPartition() {
         R<RpcStatus> dropPartition = milvusClient.dropPartition(DropPartitionParam.Builder
         R<RpcStatus> dropPartition = milvusClient.dropPartition(DropPartitionParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")
@@ -176,7 +195,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void hasPartition(){
+    public void hasPartition() {
         R<Boolean> hasPartition = milvusClient.hasPartition(HasPartitionParam.Builder
         R<Boolean> hasPartition = milvusClient.hasPartition(HasPartitionParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")
@@ -187,7 +206,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void loadPartitions(){
+    public void loadPartitions() {
         String[] partitionNames = new String[]{"par1"};
         String[] partitionNames = new String[]{"par1"};
         R<RpcStatus> loadPartition = milvusClient.loadPartitions(LoadPartitionsParam.Builder
         R<RpcStatus> loadPartition = milvusClient.loadPartitions(LoadPartitionsParam.Builder
                 .newBuilder()
                 .newBuilder()
@@ -199,7 +218,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void releasePartitions(){
+    public void releasePartitions() {
         String[] releaseNames = new String[]{"par1"};
         String[] releaseNames = new String[]{"par1"};
         R<RpcStatus> releasePartition = milvusClient.releasePartitions(ReleasePartitionsParam.Builder
         R<RpcStatus> releasePartition = milvusClient.releasePartitions(ReleasePartitionsParam.Builder
                 .newBuilder()
                 .newBuilder()
@@ -211,7 +230,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void getPartitionStatistics(){
+    public void getPartitionStatistics() {
         R<GetPartitionStatisticsResponse> getPartitionStatistics = milvusClient.getPartitionStatistics(GetPartitionStatisticsParam.Builder
         R<GetPartitionStatisticsResponse> getPartitionStatistics = milvusClient.getPartitionStatistics(GetPartitionStatisticsParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")
@@ -222,7 +241,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void showPartitions(){
+    public void showPartitions() {
         R<ShowPartitionsResponse> showPartitionsResponse = milvusClient.showPartitions(ShowPartitionParam.Builder
         R<ShowPartitionsResponse> showPartitionsResponse = milvusClient.showPartitions(ShowPartitionParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")
@@ -231,11 +250,11 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void createIndex(){
-        Map<String,String> extraParam = new HashMap<>();
-        extraParam.put("index_type","IVF_FLAT");
+    public void createIndex() {
+        Map<String, String> extraParam = new HashMap<>();
+        extraParam.put("index_type", "IVF_FLAT");
         extraParam.put("metric_type", "IP");
         extraParam.put("metric_type", "IP");
-        extraParam.put("params","{\"nlist\":10}");
+        extraParam.put("params", "{\"nlist\":10}");
         R<RpcStatus> createIndex = milvusClient.createIndex(CreateIndexParam.Builder
         R<RpcStatus> createIndex = milvusClient.createIndex(CreateIndexParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")
@@ -246,7 +265,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void dropIndex(){
+    public void dropIndex() {
         R<RpcStatus> dropIndex = milvusClient.dropIndex(DropIndexParam.Builder
         R<RpcStatus> dropIndex = milvusClient.dropIndex(DropIndexParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")
@@ -256,7 +275,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void describeIndex(){
+    public void describeIndex() {
         R<DescribeIndexResponse> describeIndex = milvusClient.describeIndex(DescribeIndexParam.Builder
         R<DescribeIndexResponse> describeIndex = milvusClient.describeIndex(DescribeIndexParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")
@@ -266,7 +285,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void getIndexState(){
+    public void getIndexState() {
         R<GetIndexStateResponse> getIndexState = milvusClient.getIndexState(GetIndexStateParam.Builder
         R<GetIndexStateResponse> getIndexState = milvusClient.getIndexState(GetIndexStateParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")
@@ -276,7 +295,7 @@ public class DDLExample {
     }
     }
 
 
     @Test
     @Test
-    public void getIndexBuildProgress(){
+    public void getIndexBuildProgress() {
         R<GetIndexBuildProgressResponse> getIndexBuildProgress = milvusClient.getIndexBuildProgress(GetIndexBuildProgressParam.Builder
         R<GetIndexBuildProgressResponse> getIndexBuildProgress = milvusClient.getIndexBuildProgress(GetIndexBuildProgressParam.Builder
                 .newBuilder()
                 .newBuilder()
                 .withCollectionName("collection1")
                 .withCollectionName("collection1")

+ 21 - 4
examples/main/io/milvus/DMLExample.java

@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package io.milvus;
 package io.milvus;
 
 
 import com.google.protobuf.ByteString;
 import com.google.protobuf.ByteString;
@@ -54,7 +73,7 @@ public class DMLExample {
         result.add(vectors);
         result.add(vectors);
 
 
         InsertParam insertParam = InsertParam.Builder
         InsertParam insertParam = InsertParam.Builder
-                .nweBuilder(collectionName)
+                .newBuilder(collectionName)
                 .setFieldNum(fieldNames.size())
                 .setFieldNum(fieldNames.size())
                 .setFieldNames(fieldNames)
                 .setFieldNames(fieldNames)
                 .setPartitionName(partitionName)
                 .setPartitionName(partitionName)
@@ -65,9 +84,7 @@ public class DMLExample {
         R<MutationResult> insert = milvusClient.insert(insertParam);
         R<MutationResult> insert = milvusClient.insert(insertParam);
         System.out.println(insert.getData());
         System.out.println(insert.getData());
 
 
-
         R<FlushResponse> flush = milvusClient.flush(collectionName);
         R<FlushResponse> flush = milvusClient.flush(collectionName);
-
         System.out.println(flush.getData());
         System.out.println(flush.getData());
     }
     }
 
 
@@ -75,7 +92,7 @@ public class DMLExample {
     public void delete() {
     public void delete() {
         String collectionName = "test";
         String collectionName = "test";
         String partitionName = "pT";
         String partitionName = "pT";
-        DeleteParam build = DeleteParam.Builder.nweBuilder()
+        DeleteParam build = DeleteParam.Builder.newBuilder()
                 .setCollectionName(collectionName)
                 .setCollectionName(collectionName)
                 .setPartitionName(partitionName)
                 .setPartitionName(partitionName)
                 .build();
                 .build();

+ 43 - 39
src/main/java/io/milvus/client/AbstractMilvusGrpcClient.java

@@ -1,18 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package io.milvus.client;
 package io.milvus.client;
 
 
 import com.google.protobuf.ByteString;
 import com.google.protobuf.ByteString;
 import io.grpc.StatusRuntimeException;
 import io.grpc.StatusRuntimeException;
-import io.milvus.exception.ParamException;
-import io.milvus.grpc.*;
-import io.milvus.param.*;
-import io.milvus.param.dml.*;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
-
 import java.nio.ByteBuffer;
 import java.nio.ByteBuffer;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
-import io.grpc.StatusRuntimeException;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import io.milvus.exception.ParamException;
+import io.milvus.grpc.*;
+import io.milvus.param.*;
+import io.milvus.param.dml.*;
 import io.milvus.grpc.BoolResponse;
 import io.milvus.grpc.BoolResponse;
 import io.milvus.grpc.CollectionSchema;
 import io.milvus.grpc.CollectionSchema;
 import io.milvus.grpc.CreateCollectionRequest;
 import io.milvus.grpc.CreateCollectionRequest;
@@ -75,13 +99,6 @@ import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 
 
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-
 public abstract class AbstractMilvusGrpcClient implements MilvusClient {
 public abstract class AbstractMilvusGrpcClient implements MilvusClient {
 
 
     private static final Logger logger = LoggerFactory.getLogger(AbstractMilvusGrpcClient.class);
     private static final Logger logger = LoggerFactory.getLogger(AbstractMilvusGrpcClient.class);
@@ -92,8 +109,6 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
 
 
     protected abstract boolean maybeAvailable();
     protected abstract boolean maybeAvailable();
 
 
-
-
     @Override
     @Override
     public R<FlushResponse> flush(String collectionName, String dbName) {
     public R<FlushResponse> flush(String collectionName, String dbName) {
         return flush(Collections.singletonList(collectionName), dbName);
         return flush(Collections.singletonList(collectionName), dbName);
@@ -102,13 +117,11 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
     @Override
     @Override
     public R<FlushResponse> flush(String collectionName) {
     public R<FlushResponse> flush(String collectionName) {
         return flush(Collections.singletonList(collectionName), "");
         return flush(Collections.singletonList(collectionName), "");
-
     }
     }
 
 
     @Override
     @Override
     public R<FlushResponse> flush(List<String> collectionNames) {
     public R<FlushResponse> flush(List<String> collectionNames) {
         return flush(collectionNames, "");
         return flush(collectionNames, "");
-
     }
     }
 
 
     @Override
     @Override
@@ -187,7 +200,6 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
             R.failed(e);
             R.failed(e);
         }
         }
         return R.success(insert);
         return R.success(insert);
-
     }
     }
 
 
     @Override
     @Override
@@ -209,7 +221,7 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
 
 
 
 
         PlaceholderValue.Builder pldBuilder = PlaceholderValue.newBuilder()
         PlaceholderValue.Builder pldBuilder = PlaceholderValue.newBuilder()
-                .setTag(Constant.vectorTag)
+                .setTag(Constant.VECTOR_TAG)
                 .setType(PlaceholderType.FloatVector);
                 .setType(PlaceholderType.FloatVector);
         byteStrings.forEach(pldBuilder::addValues);
         byteStrings.forEach(pldBuilder::addValues);
 
 
@@ -221,26 +233,26 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
 
 
         builder.addSearchParams(
         builder.addSearchParams(
                         KeyValuePair.newBuilder()
                         KeyValuePair.newBuilder()
-                                .setKey(Constant.vectorFiled)
+                                .setKey(Constant.VECTOR_FIELD)
                                 .setValue(searchParam.getVectorFieldName())
                                 .setValue(searchParam.getVectorFieldName())
                                 .build())
                                 .build())
                 .addSearchParams(
                 .addSearchParams(
                         KeyValuePair.newBuilder()
                         KeyValuePair.newBuilder()
-                                .setKey(Constant.topK)
+                                .setKey(Constant.TOP_K)
                                 .setValue(String.valueOf(searchParam.getTopK()))
                                 .setValue(String.valueOf(searchParam.getTopK()))
                                 .build())
                                 .build())
                 .addSearchParams(
                 .addSearchParams(
                         KeyValuePair.newBuilder()
                         KeyValuePair.newBuilder()
-                                .setKey(Constant.metricType)
+                                .setKey(Constant.METRIC_TYPE)
                                 .setValue(searchParam.getMetricType().name())
                                 .setValue(searchParam.getMetricType().name())
                                 .build());
                                 .build());
 
 
-        if (!searchParam.getParams().isEmpty() && null != searchParam.getParams().get(Constant.parmas)
-                && !searchParam.getParams().get(Constant.parmas).isEmpty()) {
+        if (!searchParam.getParams().isEmpty() && null != searchParam.getParams().get(Constant.PARAMS)
+                && !searchParam.getParams().get(Constant.PARAMS).isEmpty()) {
             builder.addSearchParams(
             builder.addSearchParams(
                     KeyValuePair.newBuilder()
                     KeyValuePair.newBuilder()
-                            .setKey(Constant.parmas)
-                            .setValue(searchParam.getParams().get(Constant.parmas))
+                            .setKey(Constant.PARAMS)
+                            .setValue(searchParam.getParams().get(Constant.PARAMS))
                             .build());
                             .build());
         }
         }
 
 
@@ -254,8 +266,6 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
         }
         }
 
 
         SearchRequest searchRequest = builder.build();
         SearchRequest searchRequest = builder.build();
-
-
         SearchResults search;
         SearchResults search;
         try {
         try {
             search = this.blockingStub().search(searchRequest);
             search = this.blockingStub().search(searchRequest);
@@ -350,7 +360,7 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
                         List list = (List) object;
                         List list = (List) object;
                         list.forEach(o -> floats.add((Float) o));
                         list.forEach(o -> floats.add((Float) o));
                     } else {
                     } else {
-                        throw new ParamException("参数有问题");
+                        throw new ParamException("param type unsuitable");
                     }
                     }
                 }
                 }
                 int dim = floats.size() / objects.size();
                 int dim = floats.size() / objects.size();
@@ -359,14 +369,11 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
                 return builder.setFieldName(fieldName).setType(DataType.FloatVector).setVectors(vectorField).build();
                 return builder.setFieldName(fieldName).setType(DataType.FloatVector).setVectors(vectorField).build();
             } else if (dataType == DataType.BinaryVector) {
             } else if (dataType == DataType.BinaryVector) {
                 List<ByteBuffer> bytes = objects.stream().map(p -> (ByteBuffer) p).collect(Collectors.toList());
                 List<ByteBuffer> bytes = objects.stream().map(p -> (ByteBuffer) p).collect(Collectors.toList());
-                ;
                 ByteString byteString = ByteString.copyFrom((ByteBuffer) bytes);
                 ByteString byteString = ByteString.copyFrom((ByteBuffer) bytes);
                 int dim = objects.size();
                 int dim = objects.size();
                 VectorField vectorField = VectorField.newBuilder().setDim(dim).setBinaryVector(byteString).build();
                 VectorField vectorField = VectorField.newBuilder().setDim(dim).setBinaryVector(byteString).build();
                 return builder.setFieldName(fieldName).setType(DataType.BinaryVector).setVectors(vectorField).build();
                 return builder.setFieldName(fieldName).setType(DataType.BinaryVector).setVectors(vectorField).build();
             }
             }
-
-
         } else {
         } else {
             switch (dataType) {
             switch (dataType) {
                 case None:
                 case None:
@@ -406,6 +413,7 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
                     return builder.setFieldName(fieldName).setType(dataType).setScalars(scalarField6).build();
                     return builder.setFieldName(fieldName).setType(dataType).setScalars(scalarField6).build();
             }
             }
         }
         }
+
         return null;
         return null;
     }
     }
 
 
@@ -434,19 +442,17 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
             response = blockingStub().hasCollection(hasCollectionRequest);
             response = blockingStub().hasCollection(hasCollectionRequest);
             if (response.getStatus().getErrorCode() == ErrorCode.Success) {
             if (response.getStatus().getErrorCode() == ErrorCode.Success) {
                 logInfo("Has collection check successfully!\n{}", requestParam.toString());
                 logInfo("Has collection check successfully!\n{}", requestParam.toString());
-                Boolean aBoolean = Optional.ofNullable(response)
+                Boolean value = Optional.of(response)
                         .map(BoolResponse::getValue)
                         .map(BoolResponse::getValue)
                         .orElse(false);
                         .orElse(false);
-                return R.success(aBoolean);
+                return R.success(value);
             } else {
             } else {
                 return R.failed(R.Status.valueOf(response.getStatus().getErrorCode().getNumber()));
                 return R.failed(R.Status.valueOf(response.getStatus().getErrorCode().getNumber()));
             }
             }
-
         } catch (StatusRuntimeException e) {
         } catch (StatusRuntimeException e) {
             logger.error("[milvus] hasCollection:{} request error: {}", requestParam.getCollectionName(), e.getMessage());
             logger.error("[milvus] hasCollection:{} request error: {}", requestParam.getCollectionName(), e.getMessage());
             return R.failed(e);
             return R.failed(e);
         }
         }
-
     }
     }
 
 
 
 
@@ -466,8 +472,7 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
         // Construct CollectionSchema Params
         // Construct CollectionSchema Params
         CollectionSchema.Builder collectionSchemaBuilder = CollectionSchema.newBuilder();
         CollectionSchema.Builder collectionSchemaBuilder = CollectionSchema.newBuilder();
         collectionSchemaBuilder.setName(requestParam.getCollectionName())
         collectionSchemaBuilder.setName(requestParam.getCollectionName())
-                               .setDescription(requestParam.getDescription());
-
+                .setDescription(requestParam.getDescription());
 
 
         for (FieldType fieldType : requestParam.getFieldTypes()) {
         for (FieldType fieldType : requestParam.getFieldTypes()) {
             FieldSchema.Builder fieldSchemaBuilder = FieldSchema.newBuilder()
             FieldSchema.Builder fieldSchemaBuilder = FieldSchema.newBuilder()
@@ -501,7 +506,6 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
                 .build();
                 .build();
 
 
         Status response;
         Status response;
-
         try {
         try {
             response = blockingStub().createCollection(createCollectionRequest);
             response = blockingStub().createCollection(createCollectionRequest);
 
 

+ 17 - 18
src/main/java/io/milvus/client/MilvusClient.java

@@ -19,10 +19,11 @@
 
 
 package io.milvus.client;
 package io.milvus.client;
 
 
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
 import io.milvus.grpc.*;
 import io.milvus.grpc.*;
 import io.milvus.param.*;
 import io.milvus.param.*;
-
-import java.util.List;
 import io.milvus.grpc.DescribeCollectionResponse;
 import io.milvus.grpc.DescribeCollectionResponse;
 import io.milvus.grpc.DescribeIndexResponse;
 import io.milvus.grpc.DescribeIndexResponse;
 import io.milvus.grpc.GetCollectionStatisticsResponse;
 import io.milvus.grpc.GetCollectionStatisticsResponse;
@@ -54,34 +55,32 @@ import io.milvus.param.partition.LoadPartitionsParam;
 import io.milvus.param.partition.ReleasePartitionsParam;
 import io.milvus.param.partition.ReleasePartitionsParam;
 import io.milvus.param.partition.ShowPartitionParam;
 import io.milvus.param.partition.ShowPartitionParam;
 
 
-import java.util.concurrent.TimeUnit;
-
 /** The Milvus Client Interface */
 /** The Milvus Client Interface */
 public interface MilvusClient {
 public interface MilvusClient {
 
 
-  default void close() {
-    close(TimeUnit.MINUTES.toSeconds(1));
-  }
+    default void close() {
+        close(TimeUnit.MINUTES.toSeconds(1));
+    }
 
 
-  void close(long maxWaitSeconds);
+    void close(long maxWaitSeconds);
 
 
-  R<MutationResult> insert(InsertParam insertParam);
+    R<MutationResult> insert(InsertParam insertParam);
 
 
-  R<FlushResponse> flush(String collectionName,String dbName);
+    R<FlushResponse> flush(String collectionName, String dbName);
 
 
-  R<FlushResponse> flush(String collectionName);
+    R<FlushResponse> flush(String collectionName);
 
 
-  R<FlushResponse> flush(List<String> collectionNames);
+    R<FlushResponse> flush(List<String> collectionNames);
 
 
-  R<FlushResponse> flush(List<String> collectionNames, String dbName);
+    R<FlushResponse> flush(List<String> collectionNames, String dbName);
 
 
-  R<MutationResult> delete(DeleteParam deleteParam);
+    R<MutationResult> delete(DeleteParam deleteParam);
 
 
-  R<SearchResults> search(SearchParam searchParam);
+    R<SearchResults> search(SearchParam searchParam);
 
 
-  R<QueryResults> query(QueryParam queryParam);
+    R<QueryResults> query(QueryParam queryParam);
 
 
-  R<CalcDistanceResults> calcDistance(CalcDistanceParam calcDistanceParam);
+    R<CalcDistanceResults> calcDistance(CalcDistanceParam calcDistanceParam);
 
 
     /**
     /**
      * Check if a collection exists.
      * Check if a collection exists.
@@ -192,7 +191,7 @@ public interface MilvusClient {
      * Show the statistics information of a partition.
      * Show the statistics information of a partition.
      *
      *
      * @param requestParam {@link GetPartitionStatisticsParam}
      * @param requestParam {@link GetPartitionStatisticsParam}
-     * @return  {status:result code,data:GetPartitionStatisticsResponse{status,stats}}
+     * @return {status:result code,data:GetPartitionStatisticsResponse{status,stats}}
      */
      */
     R<GetPartitionStatisticsResponse> getPartitionStatistics(GetPartitionStatisticsParam requestParam);
     R<GetPartitionStatisticsResponse> getPartitionStatistics(GetPartitionStatisticsParam requestParam);
 
 

+ 0 - 2
src/main/java/io/milvus/client/MilvusServiceClient.java

@@ -71,7 +71,5 @@ public class MilvusServiceClient extends AbstractMilvusGrpcClient {
     public void close(long maxWaitSeconds) {
     public void close(long maxWaitSeconds) {
 
 
     }
     }
-
-
 }
 }
 
 

+ 20 - 4
src/main/java/io/milvus/exception/ParamException.java

@@ -1,6 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package io.milvus.exception;
 package io.milvus.exception;
 
 
-public class ParamException extends RuntimeException{
+public class ParamException extends RuntimeException {
     private String msg;
     private String msg;
     private Integer status;
     private Integer status;
 
 
@@ -9,14 +28,11 @@ public class ParamException extends RuntimeException{
         this.status = -1;
         this.status = -1;
     }
     }
 
 
-
     public ParamException(String msg, Integer status) {
     public ParamException(String msg, Integer status) {
         this.msg = msg;
         this.msg = msg;
         this.status = status;
         this.status = status;
     }
     }
 
 
-
-
     public String getMsg() {
     public String getMsg() {
         return msg;
         return msg;
     }
     }

+ 107 - 106
src/main/java/io/milvus/param/ConnectParam.java

@@ -23,129 +23,130 @@ import javax.annotation.Nonnull;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeUnit;
 
 
 /**
 /**
- * coonectParam, timeUnit:ms
+ * connectParam, timeUnit:ms
  */
  */
 public class ConnectParam {
 public class ConnectParam {
-  private final String host;
-  private final int port;
-  private final long connectTimeoutMs;
-  private final long keepAliveTimeMs;
-  private final long keepAliveTimeoutMs;
-  private final boolean keepAliveWithoutCalls;
-  private final long idleTimeoutMs;
-
-  private ConnectParam(@Nonnull Builder builder) {
-    this.host = builder.host;
-    this.port = builder.port;
-    this.connectTimeoutMs = builder.connectTimeoutMs;
-    this.keepAliveTimeMs = builder.keepAliveTimeMs;
-    this.keepAliveTimeoutMs = builder.keepAliveTimeoutMs;
-    this.keepAliveWithoutCalls = builder.keepAliveWithoutCalls;
-    this.idleTimeoutMs = builder.idleTimeoutMs;
-  }
-
-  public String getHost() {
-    return host;
-  }
-
-  public int getPort() {
-    return port;
-  }
-
-  public long getConnectTimeoutMs() {
-    return connectTimeoutMs;
-  }
-
-  public long getKeepAliveTimeMs() {
-    return keepAliveTimeMs;
-  }
-
-  public long getKeepAliveTimeoutMs() {
-    return keepAliveTimeoutMs;
-  }
-
-  public boolean isKeepAliveWithoutCalls() {
-    return keepAliveWithoutCalls;
-  }
-
-  public long getIdleTimeoutMs() {
-    return idleTimeoutMs;
-  }
-
-  /** Builder for <code>ConnectParam</code> */
-  public static class Builder {
-    private String host = "localhost";
-    private int port = 19530;
-    private long connectTimeoutMs = 10000;
-    private long keepAliveTimeMs = Long.MAX_VALUE; // Disabling keepalive
-    private long keepAliveTimeoutMs = 20000;
-    private boolean keepAliveWithoutCalls = false;
-    private long idleTimeoutMs = TimeUnit.MILLISECONDS.convert(24, TimeUnit.HOURS);
-
-    private Builder(){}
-
-    public static Builder newBuilder(){
-      return new Builder();
+    private final String host;
+    private final int port;
+    private final long connectTimeoutMs;
+    private final long keepAliveTimeMs;
+    private final long keepAliveTimeoutMs;
+    private final boolean keepAliveWithoutCalls;
+    private final long idleTimeoutMs;
+
+    private ConnectParam(@Nonnull Builder builder) {
+        this.host = builder.host;
+        this.port = builder.port;
+        this.connectTimeoutMs = builder.connectTimeoutMs;
+        this.keepAliveTimeMs = builder.keepAliveTimeMs;
+        this.keepAliveTimeoutMs = builder.keepAliveTimeoutMs;
+        this.keepAliveWithoutCalls = builder.keepAliveWithoutCalls;
+        this.idleTimeoutMs = builder.idleTimeoutMs;
     }
     }
 
 
-    public Builder withHost(@Nonnull String host) {
-      this.host = host;
-      return this;
+    public String getHost() {
+        return host;
     }
     }
 
 
-    public Builder withPort(int port) throws IllegalArgumentException {
-      if (port < 0 || port > 0xFFFF) {
-        throw new IllegalArgumentException("Port is out of range!");
-      }
-      this.port = port;
-      return this;
+    public int getPort() {
+        return port;
     }
     }
 
 
-    public Builder withConnectTimeout(long connectTimeout, @Nonnull TimeUnit timeUnit)
-        throws IllegalArgumentException {
-      if (connectTimeout <= 0L) {
-        throw new IllegalArgumentException("Connect timeout must be positive!");
-      }
-      this.connectTimeoutMs = timeUnit.toMillis(connectTimeout);
-      return this;
+    public long getConnectTimeoutMs() {
+        return connectTimeoutMs;
     }
     }
 
 
-    public Builder withKeepAliveTime(long keepAliveTime, @Nonnull TimeUnit timeUnit)
-        throws IllegalArgumentException {
-      if (keepAliveTime <= 0L) {
-        throw new IllegalArgumentException("Keepalive time must be positive!");
-      }
-      this.keepAliveTimeMs = timeUnit.toMillis(keepAliveTime);
-      return this;
+    public long getKeepAliveTimeMs() {
+        return keepAliveTimeMs;
     }
     }
 
 
-    public Builder withKeepAliveTimeout(long keepAliveTimeout, @Nonnull TimeUnit timeUnit)
-        throws IllegalArgumentException {
-      if (keepAliveTimeout <= 0L) {
-        throw new IllegalArgumentException("Keepalive timeout must be positive!");
-      }
-      this.keepAliveTimeoutMs = timeUnit.toNanos(keepAliveTimeout);
-      return this;
+    public long getKeepAliveTimeoutMs() {
+        return keepAliveTimeoutMs;
     }
     }
 
 
-
-    public Builder keepAliveWithoutCalls(boolean enable) {
-      keepAliveWithoutCalls = enable;
-      return this;
+    public boolean isKeepAliveWithoutCalls() {
+        return keepAliveWithoutCalls;
     }
     }
 
 
-
-    public Builder withIdleTimeout(long idleTimeout, @Nonnull TimeUnit timeUnit)
-        throws IllegalArgumentException {
-      if (idleTimeout <= 0L) {
-        throw new IllegalArgumentException("Idle timeout must be positive!");
-      }
-      this.idleTimeoutMs = timeUnit.toMillis(idleTimeout);
-      return this;
+    public long getIdleTimeoutMs() {
+        return idleTimeoutMs;
     }
     }
 
 
-    public ConnectParam build() {
-      return new ConnectParam(this);
+    /**
+     * Builder for <code>ConnectParam</code>
+     */
+    public static class Builder {
+        private String host = "localhost";
+        private int port = 19530;
+        private long connectTimeoutMs = 10000;
+        private long keepAliveTimeMs = Long.MAX_VALUE; // Disabling keepalive
+        private long keepAliveTimeoutMs = 20000;
+        private boolean keepAliveWithoutCalls = false;
+        private long idleTimeoutMs = TimeUnit.MILLISECONDS.convert(24, TimeUnit.HOURS);
+
+        private Builder() {
+        }
+
+        public static Builder newBuilder() {
+            return new Builder();
+        }
+
+        public Builder withHost(@Nonnull String host) {
+            this.host = host;
+            return this;
+        }
+
+        public Builder withPort(int port) throws IllegalArgumentException {
+            if (port < 0 || port > 0xFFFF) {
+                throw new IllegalArgumentException("Port is out of range!");
+            }
+            this.port = port;
+            return this;
+        }
+
+        public Builder withConnectTimeout(long connectTimeout, @Nonnull TimeUnit timeUnit)
+                throws IllegalArgumentException {
+            if (connectTimeout <= 0L) {
+                throw new IllegalArgumentException("Connect timeout must be positive!");
+            }
+            this.connectTimeoutMs = timeUnit.toMillis(connectTimeout);
+            return this;
+        }
+
+        public Builder withKeepAliveTime(long keepAliveTime, @Nonnull TimeUnit timeUnit)
+                throws IllegalArgumentException {
+            if (keepAliveTime <= 0L) {
+                throw new IllegalArgumentException("Keepalive time must be positive!");
+            }
+            this.keepAliveTimeMs = timeUnit.toMillis(keepAliveTime);
+            return this;
+        }
+
+        public Builder withKeepAliveTimeout(long keepAliveTimeout, @Nonnull TimeUnit timeUnit)
+                throws IllegalArgumentException {
+            if (keepAliveTimeout <= 0L) {
+                throw new IllegalArgumentException("Keepalive timeout must be positive!");
+            }
+            this.keepAliveTimeoutMs = timeUnit.toNanos(keepAliveTimeout);
+            return this;
+        }
+
+        public Builder keepAliveWithoutCalls(boolean enable) {
+            keepAliveWithoutCalls = enable;
+            return this;
+        }
+
+        public Builder withIdleTimeout(long idleTimeout, @Nonnull TimeUnit timeUnit)
+                throws IllegalArgumentException {
+            if (idleTimeout <= 0L) {
+                throw new IllegalArgumentException("Idle timeout must be positive!");
+            }
+            this.idleTimeoutMs = timeUnit.toMillis(idleTimeout);
+            return this;
+        }
+
+        public ConnectParam build() {
+            return new ConnectParam(this);
+        }
     }
     }
-  }
 }
 }

+ 24 - 7
src/main/java/io/milvus/param/Constant.java

@@ -1,12 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package io.milvus.param;
 package io.milvus.param;
 
 
 public class Constant {
 public class Constant {
-
     // default value for search key
     // default value for search key
-    public static String vectorTag = "$0";
-    public static String vectorFiled = "anns_field";
-    public static String topK = "topk";
-    public static String metricType = "metric_type";
-    public static String parmas = "params";
-
+    public static final String VECTOR_TAG = "$0";
+    public static final String VECTOR_FIELD = "anns_field";
+    public static final String TOP_K = "topk";
+    public static final String METRIC_TYPE = "metric_type";
+    public static final String PARAMS = "params";
 }
 }

+ 19 - 1
src/main/java/io/milvus/param/MetricType.java

@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package io.milvus.param;
 package io.milvus.param;
 
 
 public enum MetricType {
 public enum MetricType {
@@ -11,5 +30,4 @@ public enum MetricType {
     SUBSTRUCTURE,
     SUBSTRUCTURE,
     SUPERSTRUCTURE,
     SUPERSTRUCTURE,
     ;
     ;
-
 }
 }

+ 29 - 9
src/main/java/io/milvus/param/R.java

@@ -1,6 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package io.milvus.param;
 package io.milvus.param;
 
 
 import io.milvus.grpc.ErrorCode;
 import io.milvus.grpc.ErrorCode;
+
 import java.util.Arrays;
 import java.util.Arrays;
 import java.util.Optional;
 import java.util.Optional;
 
 
@@ -33,8 +53,7 @@ public class R<T> {
         this.data = data;
         this.data = data;
     }
     }
 
 
-;
-    public static <T> R<T> failed(Exception exception){
+    public static <T> R<T> failed(Exception exception) {
         R<T> r = new R<>();
         R<T> r = new R<>();
         r.setStatus(Status.Unknown.getCode());
         r.setStatus(Status.Unknown.getCode());
         r.setException(exception);
         r.setException(exception);
@@ -48,28 +67,30 @@ public class R<T> {
         return r;
         return r;
     }
     }
 
 
-    public static <T> R<T> failed(Status statusCode){
+    public static <T> R<T> failed(Status statusCode) {
         R<T> r = new R<>();
         R<T> r = new R<>();
         r.setStatus(statusCode.getCode());
         r.setStatus(statusCode.getCode());
         r.setException(new Exception(statusCode.name()));
         r.setException(new Exception(statusCode.name()));
         return r;
         return r;
     }
     }
 
 
-    public static <T> R<T> success(){
+    public static <T> R<T> success() {
         R<T> r = new R<>();
         R<T> r = new R<>();
         r.setStatus(Status.Success.getCode());
         r.setStatus(Status.Success.getCode());
         return r;
         return r;
     }
     }
 
 
 
 
-    public static <T> R<T> success(T data){
+    public static <T> R<T> success(T data) {
         R<T> r = new R<>();
         R<T> r = new R<>();
         r.setStatus(Status.Success.getCode());
         r.setStatus(Status.Success.getCode());
         r.setData(data);
         r.setData(data);
         return r;
         return r;
     }
     }
 
 
-    /** Represents server and client side status code */
+    /**
+     * Represents server and client side status code
+     */
     public enum Status {
     public enum Status {
         // Server side error
         // Server side error
         Success(0),
         Success(0),
@@ -128,18 +149,17 @@ public class R<T> {
 
 
     @Override
     @Override
     public String toString() {
     public String toString() {
-        if(exception != null){
+        if (exception != null) {
             return "R{" +
             return "R{" +
                     "exception=" + exception.getMessage() +
                     "exception=" + exception.getMessage() +
                     ", status=" + status +
                     ", status=" + status +
                     ", data=" + data +
                     ", data=" + data +
                     '}';
                     '}';
-        }else{
+        } else {
             return "R{" +
             return "R{" +
                     "status=" + status +
                     "status=" + status +
                     ", data=" + data +
                     ", data=" + data +
                     '}';
                     '}';
         }
         }
-
     }
     }
 }
 }

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

@@ -16,8 +16,8 @@
  * specific language governing permissions and limitations
  * specific language governing permissions and limitations
  * under the License.
  * under the License.
  */
  */
-package io.milvus.param.collection;
 
 
+package io.milvus.param.collection;
 
 
 import io.milvus.grpc.DataType;
 import io.milvus.grpc.DataType;
 
 

+ 23 - 2
src/main/java/io/milvus/param/dml/CalcDistanceParam.java

@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package io.milvus.param.dml;
 package io.milvus.param.dml;
 
 
 import io.milvus.exception.ParamException;
 import io.milvus.exception.ParamException;
@@ -14,8 +33,10 @@ public class CalcDistanceParam {
     private final List<Float> vector2;
     private final List<Float> vector2;
     private final MetricType metricType;
     private final MetricType metricType;
 
 
-    public CalcDistanceParam(@Nonnull List<Float> vector1,@Nonnull List<Float> vector2,@Nonnull MetricType metricType){
-        if (vector1.size() != vector2.size()){
+    public CalcDistanceParam(@Nonnull List<Float> vector1,
+                             @Nonnull List<Float> vector2,
+                             @Nonnull MetricType metricType) {
+        if (vector1.size() != vector2.size()) {
             throw new ParamException("size is not equal");
             throw new ParamException("size is not equal");
         }
         }
 
 

+ 23 - 5
src/main/java/io/milvus/param/dml/DeleteParam.java

@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package io.milvus.param.dml;
 package io.milvus.param.dml;
 
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nonnull;
@@ -28,12 +47,12 @@ public class DeleteParam {
     public static class Builder {
     public static class Builder {
         private String dbName = "";
         private String dbName = "";
         private String collectionName;
         private String collectionName;
-        private String partitionName ;
+        private String partitionName;
 
 
         private Builder() {
         private Builder() {
         }
         }
 
 
-        public static Builder nweBuilder() {
+        public static Builder newBuilder() {
             return new Builder();
             return new Builder();
         }
         }
 
 
@@ -42,12 +61,12 @@ public class DeleteParam {
             return this;
             return this;
         }
         }
 
 
-        public Builder setDbName(@Nonnull String dbName){
+        public Builder setDbName(@Nonnull String dbName) {
             this.dbName = dbName;
             this.dbName = dbName;
             return this;
             return this;
         }
         }
 
 
-        public Builder setCollectionName(@Nonnull String collectionName){
+        public Builder setCollectionName(@Nonnull String collectionName) {
             this.collectionName = collectionName;
             this.collectionName = collectionName;
             return this;
             return this;
         }
         }
@@ -55,6 +74,5 @@ public class DeleteParam {
         public DeleteParam build() {
         public DeleteParam build() {
             return new DeleteParam(this);
             return new DeleteParam(this);
         }
         }
-
     }
     }
 }
 }

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

@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package io.milvus.param.dml;
 package io.milvus.param.dml;
 
 
 import io.milvus.grpc.DataType;
 import io.milvus.grpc.DataType;
@@ -8,8 +27,8 @@ import java.util.List;
 /**
 /**
  * fieldNames,dataTypes, fieldValues' order must be consistent.
  * fieldNames,dataTypes, fieldValues' order must be consistent.
  * explain fieldValues:
  * explain fieldValues:
- *    if dataType is scalar: ? is basic type, like Integer,Long...
- *    if dataType is FloatVector: ? is List<Float>
+ *     if dataType is scalar: ? is basic type, like Integer,Long...
+ *     if dataType is FloatVector: ? is List<Float>
  */
  */
 public class InsertParam {
 public class InsertParam {
     private final String collectionName;
     private final String collectionName;
@@ -68,7 +87,7 @@ public class InsertParam {
             this.collectionName = collectionName;
             this.collectionName = collectionName;
         }
         }
 
 
-        public static Builder nweBuilder(@Nonnull String collectionName) {
+        public static Builder newBuilder(@Nonnull String collectionName) {
             return new Builder(collectionName);
             return new Builder(collectionName);
         }
         }
 
 
@@ -100,6 +119,5 @@ public class InsertParam {
         public InsertParam build() {
         public InsertParam build() {
             return new InsertParam(this);
             return new InsertParam(this);
         }
         }
-
     }
     }
 }
 }

+ 27 - 9
src/main/java/io/milvus/param/dml/QueryParam.java

@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package io.milvus.param.dml;
 package io.milvus.param.dml;
 
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
@@ -13,7 +32,7 @@ public class QueryParam {
     private final List<String> outFields;
     private final List<String> outFields;
     private final String expr;
     private final String expr;
 
 
-    private QueryParam(@Nonnull Builder builder){
+    private QueryParam(@Nonnull Builder builder) {
         this.dbName = builder.dbName;
         this.dbName = builder.dbName;
         this.collectionName = builder.collectionName;
         this.collectionName = builder.collectionName;
         this.partitionNames = builder.partitionNames;
         this.partitionNames = builder.partitionNames;
@@ -41,32 +60,32 @@ public class QueryParam {
         return expr;
         return expr;
     }
     }
 
 
-    public static class Builder{
+    public static class Builder {
         private String dbName = "";
         private String dbName = "";
         private String collectionName;
         private String collectionName;
         private List<String> partitionNames = Lists.newArrayList();
         private List<String> partitionNames = Lists.newArrayList();
         private List<String> outFields = new ArrayList<>();
         private List<String> outFields = new ArrayList<>();
         private String expr;
         private String expr;
 
 
-        private Builder(@Nonnull String expr){
+        private Builder(@Nonnull String expr) {
             this.expr = expr;
             this.expr = expr;
         }
         }
 
 
-        public static Builder newBuilder(@Nonnull String expr){
+        public static Builder newBuilder(@Nonnull String expr) {
             return new Builder(expr);
             return new Builder(expr);
         }
         }
 
 
-        public Builder setDbName(@Nonnull String dbName){
+        public Builder setDbName(@Nonnull String dbName) {
             this.dbName = dbName;
             this.dbName = dbName;
             return this;
             return this;
         }
         }
 
 
-        public Builder setCollectionName(@Nonnull String collectionName){
+        public Builder setCollectionName(@Nonnull String collectionName) {
             this.collectionName = collectionName;
             this.collectionName = collectionName;
             return this;
             return this;
         }
         }
 
 
-        public Builder setPartitionNames(@Nonnull List<String> partitionNames){
+        public Builder setPartitionNames(@Nonnull List<String> partitionNames) {
             this.partitionNames = partitionNames;
             this.partitionNames = partitionNames;
             return this;
             return this;
         }
         }
@@ -81,9 +100,8 @@ public class QueryParam {
             return this;
             return this;
         }
         }
 
 
-        public QueryParam build(){
+        public QueryParam build() {
             return new QueryParam(this);
             return new QueryParam(this);
         }
         }
     }
     }
-
 }
 }

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

@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package io.milvus.param.dml;
 package io.milvus.param.dml;
 
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
@@ -21,9 +40,9 @@ public class SearchParam {
     private final String dsl;
     private final String dsl;
     private final List<String> outFields;
     private final List<String> outFields;
     private final List<List<Float>> vectors;
     private final List<List<Float>> vectors;
-    private final Map<String,String> params;
+    private final Map<String, String> params;
 
 
-    private SearchParam(@Nonnull Builder builder){
+    private SearchParam(@Nonnull Builder builder) {
         this.dbName = builder.dbName;
         this.dbName = builder.dbName;
         this.collectionName = builder.collectionName;
         this.collectionName = builder.collectionName;
         this.partitionNames = builder.partitionNames;
         this.partitionNames = builder.partitionNames;
@@ -81,7 +100,7 @@ public class SearchParam {
         return params;
         return params;
     }
     }
 
 
-    public static class Builder{
+    public static class Builder {
         private String dbName = "";
         private String dbName = "";
         private String collectionName;
         private String collectionName;
         private List<String> partitionNames = Lists.newArrayList();
         private List<String> partitionNames = Lists.newArrayList();
@@ -92,26 +111,26 @@ public class SearchParam {
         private String dsl;
         private String dsl;
         private List<String> outFields = new ArrayList<>();
         private List<String> outFields = new ArrayList<>();
         private List<List<Float>> vectors;
         private List<List<Float>> vectors;
-        private Map<String,String> params = new HashMap<>();
+        private Map<String, String> params = new HashMap<>();
 
 
-        private Builder(){
+        private Builder() {
         }
         }
 
 
-        public static Builder newBuilder(){
+        public static Builder newBuilder() {
             return new Builder();
             return new Builder();
         }
         }
 
 
-        public Builder setDbName(@Nonnull String dbName){
+        public Builder setDbName(@Nonnull String dbName) {
             this.dbName = dbName;
             this.dbName = dbName;
             return this;
             return this;
         }
         }
 
 
-        public Builder setCollectionName(@Nonnull String collectionName){
+        public Builder setCollectionName(@Nonnull String collectionName) {
             this.collectionName = collectionName;
             this.collectionName = collectionName;
             return this;
             return this;
         }
         }
 
 
-        public Builder setPartitionNames(@Nonnull List<String> partitionNames){
+        public Builder setPartitionNames(@Nonnull List<String> partitionNames) {
             this.partitionNames = partitionNames;
             this.partitionNames = partitionNames;
             return this;
             return this;
         }
         }
@@ -157,9 +176,8 @@ public class SearchParam {
             return this;
             return this;
         }
         }
 
 
-        public SearchParam build(){
+        public SearchParam build() {
             return new SearchParam(this);
             return new SearchParam(this);
         }
         }
     }
     }
-
 }
 }

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

@@ -27,7 +27,7 @@ import java.util.Map;
 public class CreateIndexParam {
 public class CreateIndexParam {
     private final String collectionName;
     private final String collectionName;
     private final String fieldName;
     private final String fieldName;
-    private final Map<String,String> extraParam;
+    private final Map<String, String> extraParam;
 
 
     public String getCollectionName() {
     public String getCollectionName() {
         return collectionName;
         return collectionName;
@@ -37,11 +37,10 @@ public class CreateIndexParam {
         return fieldName;
         return fieldName;
     }
     }
 
 
-    public Map<String,String> getExtraParam() {
+    public Map<String, String> getExtraParam() {
         return extraParam;
         return extraParam;
     }
     }
 
 
-
     public CreateIndexParam(Builder builder) {
     public CreateIndexParam(Builder builder) {
         this.collectionName = builder.collectionName;
         this.collectionName = builder.collectionName;
         this.fieldName = builder.fieldName;
         this.fieldName = builder.fieldName;
@@ -51,7 +50,7 @@ public class CreateIndexParam {
     public static final class Builder {
     public static final class Builder {
         private String collectionName;
         private String collectionName;
         private String fieldName;
         private String fieldName;
-        private Map<String,String> extraParam;
+        private Map<String, String> extraParam;
 
 
         private Builder() {
         private Builder() {
         }
         }
@@ -70,7 +69,7 @@ public class CreateIndexParam {
             return this;
             return this;
         }
         }
 
 
-        public Builder withExtraParam(Map<String,String> extraParam) {
+        public Builder withExtraParam(Map<String, String> extraParam) {
             this.extraParam = extraParam;
             this.extraParam = extraParam;
             return this;
             return this;
         }
         }