Browse Source

Rename bulkload to bulkinsert (#388)

Signed-off-by: yhmo <yihua.mo@zilliz.com>

Signed-off-by: yhmo <yihua.mo@zilliz.com>
groot 2 years ago
parent
commit
4afe22d188

+ 19 - 173
src/main/java/io/milvus/client/AbstractMilvusGrpcClient.java

@@ -1265,99 +1265,6 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
         }
     }
 
-//    @Override
-//    public R<ImportResponse> bulkload(@NonNull BulkloadParam requestParam) {
-//        if (!clientIsReady()) {
-//            return R.failed(new ClientNotConnectedException("Client rpc channel is not ready"));
-//        }
-//
-//        logInfo(requestParam.toString());
-//
-//        try {
-//            ImportRequest.Builder builder = ImportRequest.newBuilder();
-//            builder.setCollectionName(requestParam.getCollectionName())
-//                    .setPartitionName(requestParam.getPartitionName())
-//                    .setRowBased(requestParam.isRowBased());
-//            requestParam.getFiles().forEach(builder::addFiles);
-//            List<KeyValuePair> options = assembleKvPair(requestParam.getOptions());
-//            if (CollectionUtils.isNotEmpty(options)) {
-//                options.forEach(builder::addOptions);
-//            }
-//
-//            ImportRequest importRequest = builder.build();
-//            ImportResponse response = blockingStub().import_(importRequest);
-//
-//            if (response.getStatus().getErrorCode() == ErrorCode.Success) {
-//                logDebug("ImportRequest successfully!");
-//                return R.success(response);
-//            } else {
-//                return failedStatus("ImportRequest", response.getStatus());
-//            }
-//        } catch (StatusRuntimeException e) {
-//            logError("ImportRequest RPC failed:\n{}", e.getStatus().toString());
-//            return R.failed(e);
-//        } catch (Exception e) {
-//            logError("ImportRequest failed:\n{}", e.getMessage());
-//            return R.failed(e);
-//        }
-//    }
-//
-//    @Override
-//    public R<GetImportStateResponse> getBulkloadState(GetBulkloadStateParam requestParam) {
-//        if (!clientIsReady()) {
-//            return R.failed(new ClientNotConnectedException("Client rpc channel is not ready"));
-//        }
-//
-//        logInfo(requestParam.toString());
-//
-//        try {
-//            GetImportStateRequest importRequest = GetImportStateRequest.newBuilder()
-//                    .setTask(requestParam.getTaskID())
-//                    .build();
-//            GetImportStateResponse response = blockingStub().getImportState(importRequest);
-//
-//            if (response.getStatus().getErrorCode() == ErrorCode.Success) {
-//                logDebug("GetImportStateRequest successfully!");
-//                return R.success(response);
-//            } else {
-//                return failedStatus("GetImportStateRequest", response.getStatus());
-//            }
-//        } catch (StatusRuntimeException e) {
-//            logError("GetImportStateRequest RPC failed:\n{}", e.getStatus().toString());
-//            return R.failed(e);
-//        } catch (Exception e) {
-//            logError("GetImportStateRequest failed:\n{}", e.getMessage());
-//            return R.failed(e);
-//        }
-//    }
-//
-//    @Override
-//    public R<ListImportTasksResponse> listBulkloadTasks(@NonNull ListBulkloadTasksParam requestParam) {
-//        if (!clientIsReady()) {
-//            return R.failed(new ClientNotConnectedException("Client rpc channel is not ready"));
-//        }
-//
-//        logInfo(requestParam.toString());
-//
-//        try {
-//            ListImportTasksRequest listRequest = ListImportTasksRequest.newBuilder().build();
-//            ListImportTasksResponse response = blockingStub().listImportTasks(listRequest);
-//
-//            if (response.getStatus().getErrorCode() == ErrorCode.Success) {
-//                logDebug("ListImportTasksRequest successfully!");
-//                return R.success(response);
-//            } else {
-//                return failedStatus("ListImportTasksRequest", response.getStatus());
-//            }
-//        } catch (StatusRuntimeException e) {
-//            logError("ListImportTasksRequest RPC failed! \n{}", e.getMessage());
-//            return R.failed(e);
-//        } catch (Exception e) {
-//            logError("ListImportTasksRequest failed! \n{}", e.getMessage());
-//            return R.failed(e);
-//        }
-//    }
-
     @Override
     public R<MutationResult> insert(@NonNull InsertParam requestParam) {
         if (!clientIsReady()) {
@@ -1611,74 +1518,6 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
         return Futures.transform(response, transformFunc::apply, MoreExecutors.directExecutor());
     }
 
-//    @Override
-//    public R<CalcDistanceResults> calcDistance(@NonNull CalcDistanceParam requestParam) {
-//        if (!clientIsReady()) {
-//            return R.failed(new ClientNotConnectedException("Client rpc channel is not ready"));
-//        }
-//
-//        logInfo(requestParam.toString());
-//
-//        try {
-//            List<List<Float>> vectors_left = requestParam.getVectorsLeft();
-//            List<List<Float>> vectors_right = requestParam.getVectorsRight();
-//
-//            FloatArray.Builder left_float_array = FloatArray.newBuilder();
-//            for (List<Float> vector : vectors_left) {
-//                left_float_array.addAllData(vector);
-//            }
-//
-//            FloatArray.Builder right_float_array = FloatArray.newBuilder();
-//            for (List<Float> vector : vectors_right) {
-//                right_float_array.addAllData(vector);
-//            }
-//
-//            CalcDistanceRequest calcDistanceRequest = CalcDistanceRequest.newBuilder()
-//                    .setOpLeft(
-//                            VectorsArray.newBuilder()
-//                                    .setDataArray(
-//                                            VectorField.newBuilder()
-//                                                    .setFloatVector(left_float_array.build())
-//                                                    .setDim(vectors_left.get(0).size())
-//                                                    .build()
-//                                    )
-//                                    .build()
-//                    )
-//                    .setOpRight(
-//                            VectorsArray.newBuilder()
-//                                    .setDataArray(
-//                                            VectorField.newBuilder()
-//                                                    .setFloatVector(right_float_array.build())
-//                                                    .setDim(vectors_right.get(0).size())
-//                                                    .build()
-//                                    )
-//                                    .build()
-//                    )
-//                    .addParams(
-//                            KeyValuePair.newBuilder()
-//                                    .setKey("metric")
-//                                    .setValue(requestParam.getMetricType())
-//                                    .build()
-//                    )
-//                    .build();
-//
-//            CalcDistanceResults response = blockingStub().calcDistance(calcDistanceRequest);
-//
-//            if (response.getStatus().getErrorCode() == ErrorCode.Success) {
-//                logDebug("CalcDistanceRequest successfully!");
-//                return R.success(response);
-//            } else {
-//                return failedStatus("CalcDistanceRequest", response.getStatus());
-//            }
-//        } catch (StatusRuntimeException e) {
-//            logError("CalcDistanceRequest RPC failed:{}", e.getMessage());
-//            return R.failed(e);
-//        } catch (Exception e) {
-//            logError("CalcDistanceRequest failed:\n{}", e.getMessage());
-//            return R.failed(e);
-//        }
-//    }
-
     @Override
     public R<GetMetricsResponse> getMetrics(@NonNull GetMetricsParam requestParam) {
         if (!clientIsReady()) {
@@ -2440,18 +2279,23 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
                 importRequest.setPartitionName(requestParam.getPartitionName());
             }
 
+            List<KeyValuePair> options = assembleKvPair(requestParam.getOptions());
+            if (CollectionUtils.isNotEmpty(options)) {
+                options.forEach(importRequest::addOptions);
+            }
+
             ImportResponse response = blockingStub().import_(importRequest.build());
             if (response.getStatus().getErrorCode() != ErrorCode.Success) {
-                return failedStatus("BulkLoadImport", response.getStatus());
+                return failedStatus("BulkInsert", response.getStatus());
             }
 
-            logDebug("BulkLoadImport successfully!");
+            logDebug("BulkInsert successfully!");
             return R.success(response);
         } catch (StatusRuntimeException e) {
-            logError("BulkLoadImport RPC failed! \n{}", e.getStatus().toString());
+            logError("BulkInsert RPC failed! \n{}", e.getStatus().toString());
             return R.failed(e);
         } catch (Exception e) {
-            logError("BulkLoadImport failed! \n{}", e.getMessage());
+            logError("BulkInsert failed! \n{}", e.getMessage());
             return R.failed(e);
         }
     }
@@ -2471,16 +2315,16 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
 
             GetImportStateResponse response = blockingStub().getImportState(getImportStateRequest);
             if (response.getStatus().getErrorCode() != ErrorCode.Success) {
-                return failedStatus("GetImportState", response.getStatus());
+                return failedStatus("GetBulkInsertState", response.getStatus());
             }
 
-            logDebug("GetImportState successfully!");
+            logDebug("GetBulkInsertState successfully!");
             return R.success(response);
         } catch (StatusRuntimeException e) {
-            logError("GetImportState RPC failed! \n{}", e.getStatus().toString());
+            logError("GetBulkInsertState RPC failed! \n{}", e.getStatus().toString());
             return R.failed(e);
         } catch (Exception e) {
-            logError("GetImportState failed! \n{}", e.getMessage());
+            logError("GetBulkInsertState failed! \n{}", e.getMessage());
             return R.failed(e);
         }
     }
@@ -2495,20 +2339,22 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
 
         try {
             ListImportTasksRequest listImportTasksRequest = ListImportTasksRequest.newBuilder()
+                    .setCollectionName(requestParam.getCollectionName())
+                    .setLimit(requestParam.getLimit())
                     .build();
 
             ListImportTasksResponse response = blockingStub().listImportTasks(listImportTasksRequest);
             if (response.getStatus().getErrorCode() != ErrorCode.Success) {
-                return failedStatus("ListImportTasks", response.getStatus());
+                return failedStatus("ListBulkInsertTasks", response.getStatus());
             }
 
-            logDebug("ListImportTasks successfully!");
+            logDebug("ListBulkInsertTasks successfully!");
             return R.success(response);
         } catch (StatusRuntimeException e) {
-            logError("ListImportTasks RPC failed! \n{}", e.getStatus().toString());
+            logError("ListBulkInsertTasks RPC failed! \n{}", e.getStatus().toString());
             return R.failed(e);
         } catch (Exception e) {
-            logError("ListImportTasks failed! \n{}", e.getMessage());
+            logError("ListBulkInsertTasks failed! \n{}", e.getMessage());
             return R.failed(e);
         }
     }

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

@@ -334,30 +334,6 @@ public interface MilvusClient {
      */
     R<MutationResult> delete(DeleteParam requestParam);
 
-//    /**
-//     * Import data from external files, currently support JSON/Numpy format
-//     *
-//     * @param requestParam {@link BulkloadParam}
-//     * @return {status:result code, data:RpcStatus{msg: result message}}
-//     */
-//    R<ImportResponse> bulkload(BulkloadParam requestParam);
-//
-//    /**
-//     * Get state of bulk a load task
-//     *
-//     * @param requestParam {@link GetBulkloadStateParam}
-//     * @return {status:result code, data:GetImportStateResponse{status,state}}
-//     */
-//    R<GetImportStateResponse> getBulkloadState(GetBulkloadStateParam requestParam);
-//
-//    /**
-//     * List all bulk load tasks
-//     *
-//     * @param requestParam {@link ListBulkloadTasksParam}
-//     * @return {status:result code, data:ListImportTasksResponse{status,state}}
-//     */
-//    R<ListImportTasksResponse> listBulkloadTasks(ListBulkloadTasksParam requestParam);
-
     /**
      * Conducts ANN search on a vector field. Use expression to do filtering before search.
      *
@@ -392,14 +368,6 @@ public interface MilvusClient {
      */
     ListenableFuture<R<QueryResults>> queryAsync(QueryParam requestParam);
 
-//    /**
-//     * Calculates the distance between the specified vectors.
-//     *
-//     * @param requestParam {@link CalcDistanceParam}
-//     * @return {status:result code, data: CalcDistanceResults{distances}}
-//     */
-//    R<CalcDistanceResults> calcDistance(CalcDistanceParam requestParam);
-
     /**
      * Gets the runtime metrics information of Milvus, returns the result in .json format.
      *
@@ -599,9 +567,27 @@ public interface MilvusClient {
      */
     R<SelectGrantResponse> selectGrantForRoleAndObject(SelectGrantForRoleAndObjectParam requestParam);
 
+    /**
+     * Import data from external files, currently support JSON/Numpy format
+     *
+     * @param requestParam {@link BulkInsertParam}
+     * @return {status:result code, data:ImportResponse{status,info}}
+     */
     R<ImportResponse> bulkInsert(BulkInsertParam requestParam);
 
+    /**
+     * Get state of bulk insert task
+     *
+     * @param requestParam {@link GetBulkInsertStateParam}
+     * @return {status:result code, data:GetImportStateResponse{status,info}}
+     */
     R<GetImportStateResponse> getBulkInsertState(GetBulkInsertStateParam requestParam);
 
+    /**
+     * List bulk insert tasks
+     *
+     * @param requestParam {@link ListBulkInsertTasksParam}
+     * @return {status:result code, data:ListImportTasksResponse{status,info}}
+     */
     R<ListImportTasksResponse> listBulkInsertTasks(ListBulkInsertTasksParam requestParam);
 }

+ 0 - 5
src/main/java/io/milvus/client/MilvusMultiServiceClient.java

@@ -378,11 +378,6 @@ public class MilvusMultiServiceClient implements MilvusClient {
         return this.clusterFactory.getMaster().getClient().queryAsync(requestParam);
     }
 
-//    @Override
-//    public R<CalcDistanceResults> calcDistance(CalcDistanceParam requestParam) {
-//        return this.clusterFactory.getMaster().getClient().calcDistance(requestParam);
-//    }
-
     @Override
     public R<GetMetricsResponse> getMetrics(GetMetricsParam requestParam) {
         return this.clusterFactory.getMaster().getClient().getMetrics(requestParam);

+ 3 - 0
src/main/java/io/milvus/param/bulkinsert/BulkInsertParam.java

@@ -26,7 +26,9 @@ import lombok.NonNull;
 import org.apache.commons.lang3.StringUtils;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Parameters for <code>bulkInsert</code> interface.
@@ -37,6 +39,7 @@ public class BulkInsertParam {
     private final String partitionName;
     private final boolean rowBased;
     private final List<String> files;
+    private final Map<String, String> options = new HashMap<>();
 
     private BulkInsertParam(@NonNull Builder builder) {
         this.collectionName = builder.collectionName;

+ 40 - 2
src/main/java/io/milvus/param/bulkinsert/ListBulkInsertTasksParam.java

@@ -20,15 +20,22 @@
 package io.milvus.param.bulkinsert;
 
 import io.milvus.exception.ParamException;
+import io.milvus.param.collection.DropCollectionParam;
+import io.milvus.param.collection.LoadCollectionParam;
 import lombok.Getter;
+import lombok.NonNull;
 
 /**
  * Parameters for <code>listBulkInsertTasks</code> interface.
  */
 @Getter
 public class ListBulkInsertTasksParam {
+    private final String collectionName;
+    private final int limit;
 
-    private ListBulkInsertTasksParam() {
+    private ListBulkInsertTasksParam(@NonNull Builder builder) {
+        this.collectionName = builder.collectionName;
+        this.limit = builder.limit;
     }
 
     public static Builder newBuilder() {
@@ -39,16 +46,45 @@ public class ListBulkInsertTasksParam {
      * Builder for {@link ListBulkInsertTasksParam} class.
      */
     public static final class Builder {
+        private String collectionName;
+
+        // The limit count of returned tasks, list all tasks if the value is 0
+        // default by 0
+        private Integer limit = 0;
+
         private Builder() {
         }
 
+        /**
+         * Sets the target collection name, list all tasks if the name is empty.
+         *
+         * @param collectionName collection name
+         * @return <code>Builder</code>
+         */
+        public Builder withCollectionName(@NonNull String collectionName) {
+            this.collectionName = collectionName;
+            return this;
+        }
+
+        /**
+         * Specify limit count of returned tasks, list all tasks if the value is 0.
+         * default value is 0
+         *
+         * @param limit limit number
+         * @return <code>Builder</code>
+         */
+        public Builder withLimit(@NonNull Integer limit) {
+            this.limit = limit;
+            return this;
+        }
+
         /**
          * Verifies parameters and creates a new {@link ListBulkInsertTasksParam} instance.
          *
          * @return {@link ListBulkInsertTasksParam}
          */
         public ListBulkInsertTasksParam build() throws ParamException {
-            return new ListBulkInsertTasksParam();
+            return new ListBulkInsertTasksParam(this);
         }
     }
 
@@ -60,6 +96,8 @@ public class ListBulkInsertTasksParam {
     @Override
     public String toString() {
         return "ListBulkInsertTasksParam{" +
+                "collectionName='" + collectionName + '\'' +
+                ", limit=" + limit +
                 '}';
     }
 }

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

@@ -50,7 +50,7 @@ public class GetCollectionStatisticsParam {
 
         // if flushCollection is true, getCollectionStatistics() firstly call flush() and wait flush() finish
         // Note: use default interval and timeout to wait flush()
-        private Boolean flushCollection = Boolean.TRUE;
+        private Boolean flushCollection = Boolean.FALSE;
 
         private Builder() {
         }

+ 4 - 3
src/main/java/io/milvus/param/collection/LoadCollectionParam.java

@@ -177,9 +177,10 @@ public class LoadCollectionParam {
     public String toString() {
         return "LoadCollectionParam{" +
                 "collectionName='" + collectionName + '\'' +
-                ", syncLoad=" + syncLoad +
-                ", syncLoadWaitingInterval=" + syncLoadWaitingInterval +
-                ", syncLoadWaitingTimeout=" + syncLoadWaitingTimeout +
+                ", syncLoad=" + syncLoad + '\'' +
+                ", syncLoadWaitingInterval=" + syncLoadWaitingInterval + '\'' +
+                ", syncLoadWaitingTimeout=" + syncLoadWaitingTimeout + '\'' +
+                ", replicaNumber=" + replicaNumber + '\'' +
                 '}';
     }
 }

+ 0 - 166
src/main/java/io/milvus/param/dml/BulkloadParam.java

@@ -1,166 +0,0 @@
-///*
-// * 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;
-//
-//import com.google.common.collect.Lists;
-//import io.milvus.exception.ParamException;
-//import io.milvus.param.Constant;
-//import io.milvus.param.ParamUtils;
-//
-//import lombok.Getter;
-//import lombok.NonNull;
-//
-//import java.util.HashMap;
-//import java.util.List;
-//import java.util.Map;
-//
-///**
-// * Parameters for <code>bulkload</code> interface.
-// */
-//@Getter
-//public class BulkloadParam {
-//    private final String collectionName;
-//    private final String partitionName;
-//    private final boolean rowBased;
-//    private final List<String> files;
-//    private final Map<String, String> options = new HashMap<>();
-//
-//    private BulkloadParam(@NonNull Builder builder) {
-//        this.collectionName = builder.collectionName;
-//        this.partitionName = builder.partitionName;
-//        this.rowBased = builder.rowBased;
-//        this.files = builder.files;
-//        this.options.put(Constant.BUCKET, builder.bucketName);
-//    }
-//
-//    public static Builder newBuilder() {
-//        return new Builder();
-//    }
-//
-//    /**
-//     * Builder for {@link BulkloadParam} class.
-//     */
-//    public static class Builder {
-//        private String collectionName;
-//        private String partitionName = "";
-//        private Boolean rowBased = Boolean.TRUE;
-//        private final List<String> files = Lists.newArrayList();
-//        private String bucketName = "";
-//
-//        private Builder() {
-//        }
-//
-//        /**
-//         * Sets the collection name. Collection name cannot be empty or null.
-//         *
-//         * @param collectionName collection name
-//         * @return <code>Builder</code>
-//         */
-//        public Builder withCollectionName(@NonNull String collectionName) {
-//            this.collectionName = collectionName;
-//            return this;
-//        }
-//
-//        /**
-//         * Sets the partition name (Optional).
-//         *
-//         * @param partitionName partition name
-//         * @return <code>Builder</code>
-//         */
-//        public Builder withPartitionName(@NonNull String partitionName) {
-//            this.partitionName = partitionName;
-//            return this;
-//        }
-//
-//        /**
-//         * Row-based or column-based data
-//         *
-//         * @param rowBased true: row-based, false: column-based
-//         * @return <code>Builder</code>
-//         */
-//        public Builder withRowBased(@NonNull Boolean rowBased) {
-//            this.rowBased = rowBased;
-//            return this;
-//        }
-//
-//        /**
-//         * Sets bucket name where the files come from MinIO/S3 storage.
-//         * If bucket is not specified, the server will use the default bucket to explore.
-//         *
-//         * @param bucketName bucket name
-//         * @return <code>Builder</code>
-//         */
-//        public Builder withBucket(@NonNull String bucketName) {
-//            this.bucketName = bucketName;
-//            return this;
-//        }
-//
-//        /**
-//         * Specifies file paths to import. Each path is a relative path to the target bucket.
-//         *
-//         * @param files file paths list
-//         * @return <code>Builder</code>
-//         */
-//        public Builder withFiles(@NonNull List<String> files) {
-//            files.forEach(this::addFile);
-//            return this;
-//        }
-//
-//        /**
-//         * Specifies a file paths to import. The path is a relative path to the target bucket.
-//         *
-//         * @param filePath file relative path
-//         * @return <code>Builder</code>
-//         */
-//        public Builder addFile(@NonNull String filePath) {
-//            if (!this.files.contains(filePath)) {
-//                this.files.add(filePath);
-//            }
-//            return this;
-//        }
-//
-//        /**
-//         * Verifies parameters and creates a new {@link BulkloadParam} instance.
-//         *
-//         * @return {@link BulkloadParam}
-//         */
-//        public BulkloadParam build() throws ParamException {
-//            ParamUtils.CheckNullEmptyString(collectionName, "Collection name");
-//
-//            return new BulkloadParam(this);
-//        }
-//    }
-//
-//    /**
-//     * Constructs a <code>String</code> by {@link BulkloadParam} instance.
-//     *
-//     * @return <code>String</code>
-//     */
-//    @Override
-//    public String toString() {
-//        return "BulkloadParam{" +
-//                "collectionName='" + collectionName + '\'' +
-//                ", partitionName='" + partitionName + '\'' +
-//                ", files='" + files.toString() + '\'' +
-//                ", rowBased='" + rowBased + '\'' +
-//                ", options=" + options.toString() +
-//                '}';
-//    }
-//}

+ 0 - 144
src/main/java/io/milvus/param/dml/CalcDistanceParam.java

@@ -1,144 +0,0 @@
-///*
-// * 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;
-//
-//import io.milvus.exception.ParamException;
-//import io.milvus.param.MetricType;
-//import lombok.Getter;
-//import lombok.NonNull;
-//
-//import java.util.List;
-//
-///**
-// * Parameters for <code>calcDistance</code> interface.
-// * Note that current release of Milvus only supports float vectors calculation.
-// */
-//@Getter
-//public class CalcDistanceParam {
-//    private final List<List<Float>> vectorsLeft;
-//    private final List<List<Float>> vectorsRight;
-//    private final String metricType;
-//
-//    private CalcDistanceParam(@NonNull Builder builder) {
-//        this.vectorsLeft = builder.vectorsLeft;
-//        this.vectorsRight = builder.vectorsRight;
-//        this.metricType = builder.metricType.name();
-//    }
-//
-//    public static Builder newBuilder() {
-//        return new Builder();
-//    }
-//
-//    /**
-//     * Builder for {@link CalcDistanceParam} class.
-//     */
-//    public static class Builder {
-//        private List<List<Float>> vectorsLeft;
-//        private List<List<Float>> vectorsRight;
-//        private MetricType metricType;
-//
-//        private Builder() {
-//        }
-//
-//        /**
-//         * Sets a list of left side vectors. The list cannot be null or empty, and each vector cannot be null or empty.
-//         *
-//         * @param vectors a list of float list, each float list is a vector.
-//         * @return <code>Builder</code>
-//         */
-//        public Builder withVectorsLeft(@NonNull List<List<Float>> vectors) {
-//            this.vectorsLeft = vectors;
-//            return this;
-//        }
-//
-//        /**
-//         * Sets a list of right side vectors. The list cannot be null or empty, and each vector cannot be null or empty.
-//         *
-//         * @param vectors a list of float list, each float list is a vector.
-//         * @return <code>Builder</code>
-//         */
-//        public Builder withVectorsRight(@NonNull List<List<Float>> vectors) {
-//            this.vectorsRight = vectors;
-//            return this;
-//        }
-//
-//        /**
-//         * Sets metric type of calculation. Note that the current release of Milvus only support L2 and IP.
-//         *
-//         * @param metricType metric type
-//         * @return <code>Builder</code>
-//         */
-//        public Builder withMetricType(MetricType metricType) {
-//            this.metricType = metricType;
-//            return this;
-//        }
-//
-//        /**
-//         * Verifies parameters and creates a new {@link CalcDistanceParam} instance.
-//         *
-//         * @return {@link CalcDistanceParam}
-//         */
-//        public CalcDistanceParam build() throws ParamException {
-//            if (metricType == MetricType.INVALID) {
-//                throw new ParamException("Metric type is illegal");
-//            }
-//
-//            if (metricType != MetricType.L2 && metricType != MetricType.IP) {
-//                throw new ParamException("Only support L2 or IP metric type now!");
-//            }
-//
-//            if (vectorsLeft == null || vectorsLeft.isEmpty()) {
-//                throw new ParamException("Left vectors can not be empty");
-//            }
-//
-//            int count = vectorsLeft.get(0).size();
-//            for (List<Float> vector : vectorsLeft) {
-//                if (vector.size() != count) {
-//                    throw new ParamException("Left vector's dimension must be equal");
-//                }
-//            }
-//
-//            if (vectorsRight == null || vectorsRight.isEmpty()) {
-//                throw new ParamException("Right vectors can not be empty");
-//            }
-//
-//            count = vectorsRight.get(0).size();
-//            for (List<Float> vector : vectorsRight) {
-//                if (vector.size() != count) {
-//                    throw new ParamException("Right vector's dimension must be equal");
-//                }
-//            }
-//
-//            return new CalcDistanceParam(this);
-//        }
-//    }
-//
-//    /**
-//     * Constructs a <code>String</code> by {@link CalcDistanceParam} instance.
-//     *
-//     * @return <code>String</code>
-//     */
-//    @Override
-//    public String toString() {
-//        return "CalcDistanceParam{ left vector count:" + vectorsLeft.size() +
-//                " right vector count:" + vectorsRight.size() +
-//                '}';
-//    }
-//}

+ 0 - 67
src/main/java/io/milvus/param/dml/GetBulkloadStateParam.java

@@ -1,67 +0,0 @@
-//package io.milvus.param.dml;
-//
-//import io.milvus.exception.ParamException;
-//import lombok.Getter;
-//import lombok.NonNull;
-//
-///**
-// * Parameters for <code>getBulkloadState</code> interface.
-// */
-//@Getter
-//public class GetBulkloadStateParam {
-//    private final long taskID;
-//
-//    private GetBulkloadStateParam(@NonNull Builder builder) {
-//        this.taskID = builder.taskID;
-//    }
-//
-//    public static Builder newBuilder() {
-//        return new Builder();
-//    }
-//
-//    /**
-//     * Builder for {@link GetBulkloadStateParam} class.
-//     */
-//    public static class Builder {
-//        private Long taskID;
-//
-//        private Builder() {
-//        }
-//
-//        /**
-//         * Sets an import task id. The id is returned from bulkload() interface.
-//         *
-//         * @param taskID id of the task
-//         * @return <code>Builder</code>
-//         */
-//        public Builder withTaskID(@NonNull Long taskID) {
-//            this.taskID = taskID;
-//            return this;
-//        }
-//
-//        /**
-//         * Verifies parameters and creates a new {@link GetBulkloadStateParam} instance.
-//         *
-//         * @return {@link GetBulkloadStateParam}
-//         */
-//        public GetBulkloadStateParam build() throws ParamException {
-//            if (this.taskID == null) {
-//                throw new ParamException("Task ID not specified");
-//            }
-//
-//            return new GetBulkloadStateParam(this);
-//        }
-//    }
-//
-//    /**
-//     * Constructs a <code>String</code> by {@link GetBulkloadStateParam} instance.
-//     *
-//     * @return <code>String</code>
-//     */
-//    @Override
-//    public String toString() {
-//        return "GetBulkloadStateParam{" +
-//                "taskID='" + taskID + '\'' +
-//                '}';
-//    }
-//}

+ 0 - 41
src/main/java/io/milvus/param/dml/ListBulkloadTasksParam.java

@@ -1,41 +0,0 @@
-//package io.milvus.param.dml;
-//
-//import io.milvus.exception.ParamException;
-//import lombok.Getter;
-//import lombok.NonNull;
-//
-///**
-// * Parameters for <code>getBulkloadState</code> interface.
-// */
-//@Getter
-//public class ListBulkloadTasksParam {
-//
-//    private ListBulkloadTasksParam(@NonNull Builder builder) {
-//    }
-//
-//    public static Builder newBuilder() {
-//        return new Builder();
-//    }
-//
-//    /**
-//     * Builder for {@link ListBulkloadTasksParam} class.
-//     */
-//    public static class Builder {
-//        private Builder() {
-//        }
-//
-//        public ListBulkloadTasksParam build() throws ParamException {
-//            return new ListBulkloadTasksParam(this);
-//        }
-//    }
-//
-//    /**
-//     * Constructs a <code>String</code> by {@link ListBulkloadTasksParam} instance.
-//     *
-//     * @return <code>String</code>
-//     */
-//    @Override
-//    public String toString() {
-//        return "ListBulkloadTasksParam";
-//    }
-//}

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

@@ -53,7 +53,7 @@ public class GetPartitionStatisticsParam {
 
         // if flushCollection is true, getCollectionStatistics() firstly call flush() and wait flush() finish
         // Note: use default interval and timeout to wait flush()
-        private Boolean flushCollection = Boolean.TRUE;
+        private Boolean flushCollection = Boolean.FALSE;
 
         private Builder() {
         }

+ 21 - 1
src/main/java/io/milvus/response/GetBulkInsertStateWrapper.java

@@ -7,11 +7,12 @@ import io.milvus.grpc.KeyValuePair;
 import io.milvus.param.Constant;
 import lombok.NonNull;
 
+import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.List;
 
 /**
- * Util class to wrap response of <code>getBulkInsertState</code> interface.
+ * Util class to wrap response of <code>GetImportStateResponse</code> interface.
  */
 public class GetBulkInsertStateWrapper {
     private final GetImportStateResponse response;
@@ -71,6 +72,25 @@ public class GetBulkInsertStateWrapper {
         return response.getRowCount();
     }
 
+    /**
+     * Gets the integer timestamp when this task is created.
+     *
+     * @return the integer timestamp when this task is created
+     */
+    public long getCreateTimestamp() {
+        return response.getCreateTs();
+    }
+
+    /**
+     * Gets the timestamp in string format when this task is created.
+     *
+     * @return the timestamp in string format when this task is created
+     */
+    public String getCreateTimeStr() {
+        Timestamp ts = new Timestamp(response.getCreateTs());
+        return ts.toString();
+    }
+
     /**
      * Gets failed reason of the bulk insert task.
      *

+ 0 - 74
src/test/java/io/milvus/client/MilvusServiceClientTest.java

@@ -2093,80 +2093,6 @@ class MilvusServiceClientTest {
         testAsyncFuncByName("queryAsync", param);
     }
 
-//    @Test
-//    void calcDistanceParam() {
-//        // test throw exception with illegal input
-//        List<List<Float>> vectorsLeft = new ArrayList<>();
-//        List<List<Float>> vectorsRight = new ArrayList<>();
-//        List<Float> vector1 = Collections.singletonList(0.1F);
-//        List<Float> vector2 = Collections.singletonList(0.1F);
-//        vectorsLeft.add(vector1);
-//        vectorsRight.add(vector2);
-//
-//        assertThrows(ParamException.class, () -> CalcDistanceParam.newBuilder()
-//                .withVectorsLeft(vectorsLeft)
-//                .withVectorsRight(vectorsRight)
-//                .withMetricType(MetricType.INVALID)
-//                .build()
-//        );
-//
-//        vectorsLeft.clear();
-//        assertThrows(ParamException.class, () -> CalcDistanceParam.newBuilder()
-//                .withVectorsLeft(vectorsLeft)
-//                .withVectorsRight(vectorsRight)
-//                .withMetricType(MetricType.IP)
-//                .build()
-//        );
-//
-//        vectorsLeft.add(vector1);
-//        vectorsRight.clear();
-//        assertThrows(ParamException.class, () -> CalcDistanceParam.newBuilder()
-//                .withVectorsLeft(vectorsLeft)
-//                .withVectorsRight(vectorsRight)
-//                .withMetricType(MetricType.IP)
-//                .build()
-//        );
-//
-//        // vector dimension not equal
-//        vectorsRight.add(vector2);
-//        List<Float> vector3 = Arrays.asList(0.1F, 0.2F);
-//        vectorsLeft.add(vector3);
-//        assertThrows(ParamException.class, () -> CalcDistanceParam.newBuilder()
-//                .withVectorsLeft(vectorsLeft)
-//                .withVectorsRight(vectorsRight)
-//                .withMetricType(MetricType.IP)
-//                .build()
-//        );
-//
-//        vectorsLeft.clear();
-//        vectorsLeft.add(vector1);
-//        List<Float> vector4 = Arrays.asList(0.1F, 0.2F);
-//        vectorsRight.add(vector4);
-//        assertThrows(ParamException.class, () -> CalcDistanceParam.newBuilder()
-//                .withVectorsLeft(vectorsLeft)
-//                .withVectorsRight(vectorsRight)
-//                .withMetricType(MetricType.IP)
-//                .build()
-//        );
-//    }
-//
-//    @Test
-//    void calcDistance() {
-//        List<List<Float>> vectorsLeft = new ArrayList<>();
-//        List<List<Float>> vectorsRight = new ArrayList<>();
-//        List<Float> vector1 = Collections.singletonList(0.1F);
-//        List<Float> vector2 = Collections.singletonList(0.1F);
-//        vectorsLeft.add(vector1);
-//        vectorsRight.add(vector2);
-//        CalcDistanceParam param = CalcDistanceParam.newBuilder()
-//                .withVectorsLeft(vectorsLeft)
-//                .withVectorsRight(vectorsRight)
-//                .withMetricType(MetricType.L2)
-//                .build();
-//
-//        testFuncByName("calcDistance", param);
-//    }
-
     @Test
     void getMetricsParam() {
         // test throw exception with illegal input