Browse Source

Remove is_row_based flag of bulk_insert() (#393)

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

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

+ 0 - 1
src/main/java/io/milvus/client/AbstractMilvusGrpcClient.java

@@ -2272,7 +2272,6 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
         try {
         try {
             ImportRequest.Builder importRequest = ImportRequest.newBuilder()
             ImportRequest.Builder importRequest = ImportRequest.newBuilder()
                     .setCollectionName(requestParam.getCollectionName())
                     .setCollectionName(requestParam.getCollectionName())
-                    .setRowBased(requestParam.isRowBased())
                     .addAllFiles(requestParam.getFiles());
                     .addAllFiles(requestParam.getFiles());
 
 
             if (StringUtils.isNotEmpty(requestParam.getPartitionName())) {
             if (StringUtils.isNotEmpty(requestParam.getPartitionName())) {

+ 1 - 1
src/main/java/io/milvus/client/MilvusClient.java

@@ -568,7 +568,7 @@ public interface MilvusClient {
     R<SelectGrantResponse> selectGrantForRoleAndObject(SelectGrantForRoleAndObjectParam requestParam);
     R<SelectGrantResponse> selectGrantForRoleAndObject(SelectGrantForRoleAndObjectParam requestParam);
 
 
     /**
     /**
-     * Import data from external files, currently support JSON/Numpy format
+     * Import data from external files, currently support JSON format
      *
      *
      * @param requestParam {@link BulkInsertParam}
      * @param requestParam {@link BulkInsertParam}
      * @return {status:result code, data:ImportResponse{status,info}}
      * @return {status:result code, data:ImportResponse{status,info}}

+ 6 - 20
src/main/java/io/milvus/param/bulkinsert/BulkInsertParam.java

@@ -37,14 +37,12 @@ import java.util.Map;
 public class BulkInsertParam {
 public class BulkInsertParam {
     private final String collectionName;
     private final String collectionName;
     private final String partitionName;
     private final String partitionName;
-    private final boolean rowBased;
     private final List<String> files;
     private final List<String> files;
     private final Map<String, String> options = new HashMap<>();
     private final Map<String, String> options = new HashMap<>();
 
 
     private BulkInsertParam(@NonNull Builder builder) {
     private BulkInsertParam(@NonNull Builder builder) {
         this.collectionName = builder.collectionName;
         this.collectionName = builder.collectionName;
         this.partitionName = builder.partitionName;
         this.partitionName = builder.partitionName;
-        this.rowBased = builder.rowBased;
         this.files = builder.files;
         this.files = builder.files;
     }
     }
 
 
@@ -58,7 +56,6 @@ public class BulkInsertParam {
     public static final class Builder {
     public static final class Builder {
         private String collectionName;
         private String collectionName;
         private String partitionName;
         private String partitionName;
-        private Boolean rowBased = false;
         private final List<String> files = new ArrayList<>();
         private final List<String> files = new ArrayList<>();
         private Builder() {
         private Builder() {
         }
         }
@@ -86,18 +83,8 @@ public class BulkInsertParam {
         }
         }
 
 
         /**
         /**
-         * Sets the file description. The description can be empty. The default is false.
-         *
-         * @param rowBased description of the file
-         * @return <code>Builder</code>
-         */
-        public Builder withRowBased(@NonNull Boolean rowBased) {
-            this.rowBased = rowBased;
-            return this;
-        }
-
-        /**
-         * Sets the path of the files. The files cannot be empty or null.
+         * Sets the path of the files. The paths cannot be empty or null.
+         * Each file path must be a relative path under the Milvus storage root path.
          *
          *
          * @param files a <code>List</code> of {@link String}
          * @param files a <code>List</code> of {@link String}
          * @return <code>Builder</code>
          * @return <code>Builder</code>
@@ -108,8 +95,8 @@ public class BulkInsertParam {
         }
         }
 
 
         /**
         /**
-         * Adds a file path.
-         * @see String
+         * Adds a file path. The path cannot be empty or null.
+         * The file path must be a relative path under the Milvus storage root path.
          *
          *
          * @param file a {@link String}
          * @param file a {@link String}
          * @return <code>Builder</code>
          * @return <code>Builder</code>
@@ -129,12 +116,12 @@ public class BulkInsertParam {
 
 
 
 
             if (files.isEmpty()) {
             if (files.isEmpty()) {
-                throw new ParamException("Field numbers must be larger than 0");
+                throw new ParamException("File path is required");
             }
             }
 
 
             for (String file : files) {
             for (String file : files) {
                 if (StringUtils.isEmpty(file)) {
                 if (StringUtils.isEmpty(file)) {
-                    throw new ParamException("file field cannot be empty");
+                    throw new ParamException("File path cannot be empty or null");
                 }
                 }
             }
             }
 
 
@@ -152,7 +139,6 @@ public class BulkInsertParam {
         return "BulkInsertParam{" +
         return "BulkInsertParam{" +
                 "collectionName='" + collectionName + '\'' +
                 "collectionName='" + collectionName + '\'' +
                 ", partitionName=" + partitionName +
                 ", partitionName=" + partitionName +
-                ", rowBased='" + rowBased + '\'' +
                 ", files=" + files.toString() +
                 ", files=" + files.toString() +
                 '}';
                 '}';
     }
     }

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

@@ -48,7 +48,7 @@ public class GetBulkInsertStateParam {
         }
         }
 
 
         /**
         /**
-         * Sets the task id. task cannot be empty or null.
+         * Sets the task id.
          *
          *
          * @param task task id
          * @param task task id
          * @return <code>Builder</code>
          * @return <code>Builder</code>
@@ -77,7 +77,7 @@ public class GetBulkInsertStateParam {
     @Override
     @Override
     public String toString() {
     public String toString() {
         return "GetBulkInsertStateParam{" +
         return "GetBulkInsertStateParam{" +
-                "task='" + task + '\'' +
+                "taskID='" + task + '\'' +
                 '}';
                 '}';
     }
     }
 }
 }

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

@@ -75,6 +75,9 @@ public class ListBulkInsertTasksParam {
          */
          */
         public Builder withLimit(@NonNull Integer limit) {
         public Builder withLimit(@NonNull Integer limit) {
             this.limit = limit;
             this.limit = limit;
+            if (this.limit < 0) {
+                this.limit = 0;
+            }
             return this;
             return this;
         }
         }