diff --git a/examples/pom.xml b/examples/pom.xml
index 91d9532f9..aef753bfa 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -77,12 +77,6 @@
tensorflow-core-platform
0.5.0
-
- org.projectlombok
- lombok
- 1.18.22
- provided
-
org.slf4j
slf4j-log4j12
diff --git a/examples/src/main/java/io/milvus/v1/ArrayFieldExample.java b/examples/src/main/java/io/milvus/v1/ArrayFieldExample.java
index bad93ce96..c61493c48 100644
--- a/examples/src/main/java/io/milvus/v1/ArrayFieldExample.java
+++ b/examples/src/main/java/io/milvus/v1/ArrayFieldExample.java
@@ -34,7 +34,10 @@
import io.milvus.param.index.CreateIndexParam;
import io.milvus.response.QueryResultsWrapper;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
public class ArrayFieldExample {
private static final String COLLECTION_NAME = "java_sdk_example_array_v1";
@@ -141,7 +144,7 @@ public static void main(String[] args) {
List strArray = new ArrayList<>();
int capacity = random.nextInt(5) + 5;
for (int k = 0; k < capacity; k++) {
- intArray.add((i+k)%100);
+ intArray.add((i + k) % 100);
strArray.add(String.format("string-%d-%d", i, k));
}
intArrArray.add(intArray);
@@ -186,7 +189,7 @@ public static void main(String[] args) {
.withConsistencyLevel(ConsistencyLevelEnum.STRONG)
.build());
QueryResultsWrapper queryWrapper = new QueryResultsWrapper(queryRet.getData());
- System.out.printf("%d rows in collection\n", (long)queryWrapper.getFieldWrapper("count(*)").getFieldData().get(0));
+ System.out.printf("%d rows in collection\n", (long) queryWrapper.getFieldWrapper("count(*)").getFieldData().get(0));
// Query by filtering expression
queryWithExpr(client, "array_int32[0] == 99");
diff --git a/examples/src/main/java/io/milvus/v1/BinaryVectorExample.java b/examples/src/main/java/io/milvus/v1/BinaryVectorExample.java
index 85ca00d94..5787a52cd 100644
--- a/examples/src/main/java/io/milvus/v1/BinaryVectorExample.java
+++ b/examples/src/main/java/io/milvus/v1/BinaryVectorExample.java
@@ -42,7 +42,7 @@ public class BinaryVectorExample {
private static final String VECTOR_FIELD = "vector";
private static final Integer VECTOR_DIM = 128;
-
+
public static void main(String[] args) {
// Connect to Milvus server. Replace the "localhost" and port with your Milvus server address.
@@ -172,7 +172,7 @@ public static void main(String[] args) {
System.out.printf("The result of No.%d target vector:\n", i);
for (SearchResultsWrapper.IDScore score : scores) {
System.out.println(score);
- ByteBuffer vector = (ByteBuffer)score.get(VECTOR_FIELD);
+ ByteBuffer vector = (ByteBuffer) score.get(VECTOR_FIELD);
CommonUtils.printBinaryVector(vector);
}
if (scores.get(0).getLongID() != k) {
diff --git a/examples/src/main/java/io/milvus/v1/BulkWriterExample.java b/examples/src/main/java/io/milvus/v1/BulkWriterExample.java
index cea07c4c4..80f46af56 100644
--- a/examples/src/main/java/io/milvus/v1/BulkWriterExample.java
+++ b/examples/src/main/java/io/milvus/v1/BulkWriterExample.java
@@ -24,11 +24,7 @@
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-import io.milvus.bulkwriter.BulkWriter;
-import io.milvus.bulkwriter.LocalBulkWriter;
-import io.milvus.bulkwriter.LocalBulkWriterParam;
-import io.milvus.bulkwriter.RemoteBulkWriter;
-import io.milvus.bulkwriter.RemoteBulkWriterParam;
+import io.milvus.bulkwriter.*;
import io.milvus.bulkwriter.common.clientenum.BulkFileType;
import io.milvus.bulkwriter.common.clientenum.CloudStorage;
import io.milvus.bulkwriter.common.utils.GeneratorUtils;
@@ -50,19 +46,8 @@
import io.milvus.grpc.DataType;
import io.milvus.grpc.GetCollectionStatisticsResponse;
import io.milvus.grpc.QueryResults;
-import io.milvus.param.ConnectParam;
-import io.milvus.param.IndexType;
-import io.milvus.param.MetricType;
-import io.milvus.param.R;
-import io.milvus.param.RpcStatus;
-import io.milvus.param.collection.CollectionSchemaParam;
-import io.milvus.param.collection.CreateCollectionParam;
-import io.milvus.param.collection.DropCollectionParam;
-import io.milvus.param.collection.FieldType;
-import io.milvus.param.collection.FlushParam;
-import io.milvus.param.collection.GetCollectionStatisticsParam;
-import io.milvus.param.collection.HasCollectionParam;
-import io.milvus.param.collection.LoadCollectionParam;
+import io.milvus.param.*;
+import io.milvus.param.collection.*;
import io.milvus.param.dml.QueryParam;
import io.milvus.param.index.CreateIndexParam;
import io.milvus.response.GetCollStatResponseWrapper;
@@ -74,11 +59,7 @@
import java.io.File;
import java.io.IOException;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.concurrent.TimeUnit;
@@ -596,7 +577,7 @@ private void callCloudImport(List> batchFiles, String collectionNam
/**
* @param collectionSchema collection info
- * @param dropIfExist if collection already exist, will drop firstly and then create again
+ * @param dropIfExist if collection already exist, will drop firstly and then create again
*/
private void createCollection(String collectionName, CollectionSchemaParam collectionSchema, boolean dropIfExist) {
System.out.println("\n===================== create collection ====================");
diff --git a/examples/src/main/java/io/milvus/v1/ClientPoolExample.java b/examples/src/main/java/io/milvus/v1/ClientPoolExample.java
index 72dd615f9..634b2be56 100644
--- a/examples/src/main/java/io/milvus/v1/ClientPoolExample.java
+++ b/examples/src/main/java/io/milvus/v1/ClientPoolExample.java
@@ -38,7 +38,10 @@
import io.milvus.response.QueryResultsWrapper;
import java.time.Duration;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
public class ClientPoolExample {
public static String serverUri = "http://localhost:19530";
@@ -51,6 +54,7 @@ private static void printKeyClientNumber(MilvusClientV1Pool pool, String key) {
System.out.printf("Key '%s': %d idle clients and %d active clients%n",
key, pool.getIdleClientNumber(key), pool.getActiveClientNumber(key));
}
+
private static void printClientNumber(MilvusClientV1Pool pool) {
System.out.println("======================================================================");
System.out.printf("Total %d idle clients and %d active clients%n",
@@ -158,7 +162,7 @@ public static Thread runInsertThread(MilvusClientV1Pool pool, String dbName, int
Gson gson = new Gson();
for (int i = 0; i < repeatRequests; i++) {
MilvusClient client = null;
- while(client == null) {
+ while (client == null) {
try {
// getClient() might exceeds the borrowMaxWaitMillis and throw exception
// retry to call until it return a client
@@ -201,7 +205,7 @@ public static Thread runSearchThread(MilvusClientV1Pool pool, String dbName, int
Thread t = new Thread(() -> {
for (int i = 0; i < repeatRequests; i++) {
MilvusClient client = null;
- while(client == null) {
+ while (client == null) {
try {
// getClient() might exceeds the borrowMaxWaitMillis and throw exception
// retry to call until it return a client
@@ -253,7 +257,7 @@ public static void verifyRowCount(MilvusClientV1Pool pool, long expectedCount) {
.withConsistencyLevel(ConsistencyLevelEnum.STRONG)
.build());
QueryResultsWrapper queryWrapper = new QueryResultsWrapper(queryRet.getData());
- long rowCount = (long)queryWrapper.getFieldWrapper("count(*)").getFieldData().get(0);
+ long rowCount = (long) queryWrapper.getFieldWrapper("count(*)").getFieldData().get(0);
System.out.printf("%d rows persisted in collection '%s' of database '%s'%n",
rowCount, CollectionName, dbName);
if (rowCount != expectedCount) {
@@ -359,7 +363,7 @@ public static void main(String[] args) throws InterruptedException {
printClientNumber(pool);
// check row count of each collection, there are threadCount*repeatRequests rows were inserted by multiple threads
- verifyRowCount(pool, threadCount*repeatRequests);
+ verifyRowCount(pool, threadCount * repeatRequests);
// drop collections
dropCollections(pool);
// drop databases, only after database is empty, it is able to be dropped
@@ -367,7 +371,7 @@ public static void main(String[] args) throws InterruptedException {
long end = System.currentTimeMillis();
System.out.printf("%d insert requests and %d search requests finished in %.3f seconds%n",
- threadCount*repeatRequests*3, threadCount*repeatRequests*3, (end-start)*0.001);
+ threadCount * repeatRequests * 3, threadCount * repeatRequests * 3, (end - start) * 0.001);
printClientNumber(pool);
pool.clear(); // clear idle clients
diff --git a/examples/src/main/java/io/milvus/v1/CommonUtils.java b/examples/src/main/java/io/milvus/v1/CommonUtils.java
index 0d89dab49..e41f0c5d4 100644
--- a/examples/src/main/java/io/milvus/v1/CommonUtils.java
+++ b/examples/src/main/java/io/milvus/v1/CommonUtils.java
@@ -20,7 +20,6 @@
import io.milvus.common.utils.Float16Utils;
import io.milvus.param.R;
-
import org.tensorflow.Tensor;
import org.tensorflow.ndarray.Shape;
import org.tensorflow.ndarray.buffer.ByteDataBuffer;
@@ -69,7 +68,7 @@ public static List> generateFloatVectors(int dimension, int count) {
public static List> generateFixFloatVectors(int dimension, int count) {
List> vectors = new ArrayList<>();
for (int n = 0; n < count; ++n) {
- List vector = generateFloatVector(dimension, (float)n);
+ List vector = generateFloatVector(dimension, (float) n);
vectors.add(vector);
}
return vectors;
@@ -87,7 +86,7 @@ public static void compareFloatVectors(List vec1, List vec2) {
}
}
- /////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// //////////////////////////////////////////////////////////////////////////////////////////////////
public static ByteBuffer generateBinaryVector(int dimension) {
Random ran = new Random();
int byteCount = dimension / 8;
@@ -117,7 +116,7 @@ public static void printBinaryVector(ByteBuffer vector) {
System.out.println();
}
- /////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// //////////////////////////////////////////////////////////////////////////////////////////////////
public static TBfloat16 genTensorflowBF16Vector(int dimension) {
Random ran = new Random();
float[] array = new float[dimension];
@@ -131,7 +130,7 @@ public static TBfloat16 genTensorflowBF16Vector(int dimension) {
public static List genTensorflowBF16Vectors(int dimension, int count) {
List vectors = new ArrayList<>();
for (int n = 0; n < count; ++n) {
- TBfloat16 vector = genTensorflowBF16Vector(dimension);
+ TBfloat16 vector = genTensorflowBF16Vector(dimension);
vectors.add(vector);
}
@@ -140,7 +139,7 @@ public static List genTensorflowBF16Vectors(int dimension, int count)
public static ByteBuffer encodeTensorBF16Vector(TBfloat16 vector) {
ByteDataBuffer tensorBuf = vector.asRawTensor().data();
- ByteBuffer buf = ByteBuffer.allocate((int)tensorBuf.size());
+ ByteBuffer buf = ByteBuffer.allocate((int) tensorBuf.size());
for (long i = 0; i < tensorBuf.size(); i++) {
buf.put(tensorBuf.getByte(i));
}
@@ -157,10 +156,10 @@ public static List encodeTensorBF16Vectors(List vectors)
}
public static TBfloat16 decodeBF16VectorToTensor(ByteBuffer buf) {
- if (buf.limit()%2 != 0) {
+ if (buf.limit() % 2 != 0) {
return null;
}
- int dim = buf.limit()/2;
+ int dim = buf.limit() / 2;
ByteDataBuffer bf = DataBuffers.of(buf.array());
return Tensor.of(TBfloat16.class, Shape.of(dim), bf);
}
@@ -197,7 +196,7 @@ public static List genTensorflowFP16Vectors(int dimension, int count)
public static ByteBuffer encodeTensorFP16Vector(TFloat16 vector) {
ByteDataBuffer tensorBuf = vector.asRawTensor().data();
- ByteBuffer buf = ByteBuffer.allocate((int)tensorBuf.size());
+ ByteBuffer buf = ByteBuffer.allocate((int) tensorBuf.size());
for (long i = 0; i < tensorBuf.size(); i++) {
buf.put(tensorBuf.getByte(i));
}
@@ -214,10 +213,10 @@ public static List encodeTensorFP16Vectors(List vectors) {
}
public static TFloat16 decodeFP16VectorToTensor(ByteBuffer buf) {
- if (buf.limit()%2 != 0) {
+ if (buf.limit() % 2 != 0) {
return null;
}
- int dim = buf.limit()/2;
+ int dim = buf.limit() / 2;
ByteDataBuffer bf = DataBuffers.of(buf.array());
return Tensor.of(TFloat16.class, Shape.of(dim), bf);
}
@@ -231,7 +230,7 @@ public static List decodeFP16VectorToFloat(ByteBuffer buf) {
return vector;
}
- /////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// //////////////////////////////////////////////////////////////////////////////////////////////////
public static ByteBuffer encodeFloat16Vector(List originVector, boolean bfloat16) {
if (bfloat16) {
return Float16Utils.f32VectorToBf16Buffer(originVector);
@@ -274,7 +273,7 @@ public static List generateFloat16Vectors(int dimension, int count,
return vectors;
}
- /////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// //////////////////////////////////////////////////////////////////////////////////////////////////
public static ByteBuffer generateInt8Vector(int dimension) {
Random ran = new Random();
int byteCount = dimension;
@@ -295,13 +294,13 @@ public static List generateInt8Vectors(int dimension, int count) {
return vectors;
}
- /////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// //////////////////////////////////////////////////////////////////////////////////////////////////
public static SortedMap generateSparseVector() {
Random ran = new Random();
SortedMap sparse = new TreeMap<>();
int dim = ran.nextInt(10) + 10;
while (sparse.size() < dim) {
- sparse.put((long)ran.nextInt(1000000), ran.nextFloat());
+ sparse.put((long) ran.nextInt(1000000), ran.nextFloat());
}
return sparse;
}
diff --git a/examples/src/main/java/io/milvus/v1/ConsistencyLevelExample.java b/examples/src/main/java/io/milvus/v1/ConsistencyLevelExample.java
index c8b58f45b..f39477fda 100644
--- a/examples/src/main/java/io/milvus/v1/ConsistencyLevelExample.java
+++ b/examples/src/main/java/io/milvus/v1/ConsistencyLevelExample.java
@@ -137,7 +137,7 @@ private static List search(String collectionName,
.withCollectionName(collectionName)
.withVectorFieldName("vector")
.withFloatVectors(Collections.singletonList(CommonUtils.generateFloatVector(VECTOR_DIM)))
- .withLimit((long)topK)
+ .withLimit((long) topK)
.withMetricType(MetricType.L2)
.build());
CommonUtils.handleResponseStatus(searchR);
@@ -187,7 +187,7 @@ private static void testSessionLevel() throws ClassNotFoundException, NoSuchMeth
row.add("vector", gson.toJsonTree(vector));
// insert by a MilvusClient
- String clientName1 = String.format("client_%d", i%10);
+ String clientName1 = String.format("client_%d", i % 10);
MilvusClient client1 = pool.getClient(clientName1);
client1.insert(InsertParam.newBuilder()
.withCollectionName(collectionName)
@@ -198,7 +198,7 @@ private static void testSessionLevel() throws ClassNotFoundException, NoSuchMeth
// search by another MilvusClient, use the just inserted vector to search
// the returned item is expected to be the just inserted item
- String clientName2 = String.format("client_%d", i%10+1);
+ String clientName2 = String.format("client_%d", i % 10 + 1);
MilvusClient client2 = pool.getClient(clientName2);
R searchR = client2.search(SearchParam.newBuilder()
.withCollectionName(collectionName)
diff --git a/examples/src/main/java/io/milvus/v1/Float16VectorExample.java b/examples/src/main/java/io/milvus/v1/Float16VectorExample.java
index 9cd1c21ac..1ebbf0c16 100644
--- a/examples/src/main/java/io/milvus/v1/Float16VectorExample.java
+++ b/examples/src/main/java/io/milvus/v1/Float16VectorExample.java
@@ -22,12 +22,19 @@
import com.google.gson.JsonObject;
import io.milvus.client.MilvusServiceClient;
import io.milvus.common.clientenum.ConsistencyLevelEnum;
-import io.milvus.grpc.*;
+import io.milvus.grpc.DataType;
+import io.milvus.grpc.MutationResult;
+import io.milvus.grpc.QueryResults;
+import io.milvus.grpc.SearchResults;
import io.milvus.param.*;
import io.milvus.param.collection.*;
-import io.milvus.param.dml.*;
-import io.milvus.param.index.*;
-import io.milvus.response.*;
+import io.milvus.param.dml.InsertParam;
+import io.milvus.param.dml.QueryParam;
+import io.milvus.param.dml.SearchParam;
+import io.milvus.param.index.CreateIndexParam;
+import io.milvus.response.FieldDataWrapper;
+import io.milvus.response.QueryResultsWrapper;
+import io.milvus.response.SearchResultsWrapper;
import org.tensorflow.types.TBfloat16;
import org.tensorflow.types.TFloat16;
@@ -42,6 +49,7 @@ public class Float16VectorExample {
private static final Integer VECTOR_DIM = 128;
private static final MilvusServiceClient milvusClient;
+
static {
// Connect to Milvus server. Replace the "localhost" and port with your Milvus server address.
milvusClient = new MilvusServiceClient(ConnectParam.newBuilder()
@@ -179,7 +187,7 @@ private static void testFloat16(boolean bfloat16) {
// Ensure the returned top1 item's ID should be equal to target vector's ID
for (int i = 0; i < 10; i++) {
Random ran = new Random();
- int k = ran.nextInt(batchRowCount*2);
+ int k = ran.nextInt(batchRowCount * 2);
ByteBuffer targetVector = encodedVectors.get(k);
SearchParam.Builder builder = SearchParam.newBuilder()
.withCollectionName(COLLECTION_NAME)
@@ -208,7 +216,7 @@ private static void testFloat16(boolean bfloat16) {
firstScore.getLongID(), k));
}
- ByteBuffer outputBuf = (ByteBuffer)firstScore.get(VECTOR_FIELD);
+ ByteBuffer outputBuf = (ByteBuffer) firstScore.get(VECTOR_FIELD);
if (!outputBuf.equals(targetVector)) {
throw new RuntimeException(String.format("The output vector is not equal to target vector: ID %d", k));
}
@@ -229,7 +237,7 @@ private static void testFloat16(boolean bfloat16) {
// Retrieve some data and verify the output
for (int i = 0; i < 10; i++) {
Random ran = new Random();
- int k = ran.nextInt(batchRowCount*2);
+ int k = ran.nextInt(batchRowCount * 2);
R queryR = milvusClient.query(QueryParam.newBuilder()
.withCollectionName(COLLECTION_NAME)
.withExpr(String.format("id == %d", k))
diff --git a/examples/src/main/java/io/milvus/v1/GeneralExample.java b/examples/src/main/java/io/milvus/v1/GeneralExample.java
index ee24f7514..b0aeb90a0 100644
--- a/examples/src/main/java/io/milvus/v1/GeneralExample.java
+++ b/examples/src/main/java/io/milvus/v1/GeneralExample.java
@@ -46,7 +46,7 @@ public class GeneralExample {
ConnectParam connectParam = ConnectParam.newBuilder()
.withHost("localhost")
.withPort(19530)
- .withAuthorization("root","Milvus")
+ .withAuthorization("root", "Milvus")
.build();
RetryParam retryParam = RetryParam.newBuilder()
.withMaxRetryTimes(3)
diff --git a/examples/src/main/java/io/milvus/v1/HighLevelExample.java b/examples/src/main/java/io/milvus/v1/HighLevelExample.java
index 279b390be..d47ecf40b 100644
--- a/examples/src/main/java/io/milvus/v1/HighLevelExample.java
+++ b/examples/src/main/java/io/milvus/v1/HighLevelExample.java
@@ -18,21 +18,26 @@
*/
package io.milvus.v1;
+import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
-import com.google.common.collect.Lists;
import io.milvus.client.MilvusServiceClient;
import io.milvus.common.clientenum.ConsistencyLevelEnum;
import io.milvus.common.utils.VectorUtils;
-import io.milvus.grpc.*;
-import io.milvus.param.*;
-import io.milvus.param.collection.*;
-import io.milvus.param.highlevel.collection.response.ListCollectionsResponse;
+import io.milvus.grpc.DescribeCollectionResponse;
+import io.milvus.param.ConnectParam;
+import io.milvus.param.IndexType;
+import io.milvus.param.R;
+import io.milvus.param.RpcStatus;
+import io.milvus.param.collection.DescribeCollectionParam;
+import io.milvus.param.collection.FlushParam;
import io.milvus.param.highlevel.collection.CreateSimpleCollectionParam;
import io.milvus.param.highlevel.collection.ListCollectionsParam;
+import io.milvus.param.highlevel.collection.response.ListCollectionsResponse;
import io.milvus.param.highlevel.dml.*;
import io.milvus.param.highlevel.dml.response.*;
-import io.milvus.response.*;
+import io.milvus.response.DescCollResponseWrapper;
+import io.milvus.response.QueryResultsWrapper;
import java.util.ArrayList;
import java.util.List;
@@ -46,7 +51,7 @@ public class HighLevelExample {
ConnectParam connectParam = ConnectParam.newBuilder()
.withHost("localhost")
.withPort(19530)
- .withAuthorization("root","Milvus")
+ .withAuthorization("root", "Milvus")
.build();
milvusClient = new MilvusServiceClient(connectParam);
}
@@ -68,7 +73,7 @@ public class HighLevelExample {
private static final String BOOL_FIELD_NAME = "bool";
private static final String FLOAT_FIELD_NAME = "float";
private static final String DOUBLE_FIELD_NAME = "double";
-
+
private R describeCollection() {
System.out.println("========== describeCollection() ==========");
diff --git a/examples/src/main/java/io/milvus/v1/HybridSearchExample.java b/examples/src/main/java/io/milvus/v1/HybridSearchExample.java
index 1b9444184..7640ec2f0 100644
--- a/examples/src/main/java/io/milvus/v1/HybridSearchExample.java
+++ b/examples/src/main/java/io/milvus/v1/HybridSearchExample.java
@@ -29,8 +29,10 @@
import io.milvus.grpc.SearchResults;
import io.milvus.param.*;
import io.milvus.param.collection.*;
-import io.milvus.param.dml.*;
-import io.milvus.param.dml.ranker.*;
+import io.milvus.param.dml.AnnSearchParam;
+import io.milvus.param.dml.HybridSearchParam;
+import io.milvus.param.dml.InsertParam;
+import io.milvus.param.dml.ranker.RRFRanker;
import io.milvus.param.index.CreateIndexParam;
import io.milvus.response.GetCollStatResponseWrapper;
import io.milvus.response.SearchResultsWrapper;
diff --git a/examples/src/main/java/io/milvus/v1/IteratorExample.java b/examples/src/main/java/io/milvus/v1/IteratorExample.java
index 3615dd2e7..59ce3719c 100644
--- a/examples/src/main/java/io/milvus/v1/IteratorExample.java
+++ b/examples/src/main/java/io/milvus/v1/IteratorExample.java
@@ -24,22 +24,16 @@
import io.milvus.client.MilvusServiceClient;
import io.milvus.common.clientenum.ConsistencyLevelEnum;
import io.milvus.grpc.DataType;
-import io.milvus.grpc.FlushResponse;
import io.milvus.grpc.GetCollectionStatisticsResponse;
import io.milvus.grpc.MutationResult;
-import io.milvus.param.ConnectParam;
-import io.milvus.param.IndexType;
-import io.milvus.param.MetricType;
-import io.milvus.param.R;
-import io.milvus.param.RetryParam;
-import io.milvus.param.RpcStatus;
+import io.milvus.orm.iterator.QueryIterator;
+import io.milvus.orm.iterator.SearchIterator;
+import io.milvus.param.*;
import io.milvus.param.collection.*;
import io.milvus.param.dml.InsertParam;
import io.milvus.param.dml.QueryIteratorParam;
import io.milvus.param.dml.SearchIteratorParam;
import io.milvus.param.index.CreateIndexParam;
-import io.milvus.orm.iterator.QueryIterator;
-import io.milvus.orm.iterator.SearchIterator;
import io.milvus.response.GetCollStatResponseWrapper;
import io.milvus.response.QueryResultsWrapper;
diff --git a/examples/src/main/java/io/milvus/v1/JsonFieldExample.java b/examples/src/main/java/io/milvus/v1/JsonFieldExample.java
index 0c7887979..7ceedb7ce 100644
--- a/examples/src/main/java/io/milvus/v1/JsonFieldExample.java
+++ b/examples/src/main/java/io/milvus/v1/JsonFieldExample.java
@@ -142,7 +142,7 @@ public static void main(String[] args) {
JsonObject metadata = new JsonObject();
metadata.addProperty("path", String.format("\\root/abc/path_%d", i));
metadata.addProperty("size", i);
- if (i%7 == 0) {
+ if (i % 7 == 0) {
metadata.addProperty("special", true);
}
@@ -152,8 +152,8 @@ public static void main(String[] args) {
// System.out.println(metadata);
// dynamic fields
- if (i%2 == 0) {
- row.addProperty("dynamic1", (double)i/3);
+ if (i % 2 == 0) {
+ row.addProperty("dynamic1", (double) i / 3);
} else {
row.addProperty("dynamic2", "ok");
}
@@ -172,7 +172,7 @@ public static void main(String[] args) {
.withConsistencyLevel(ConsistencyLevelEnum.STRONG)
.build());
QueryResultsWrapper queryWrapper = new QueryResultsWrapper(queryRet.getData());
- long rowCount = (long)queryWrapper.getFieldWrapper("count(*)").getFieldData().get(0);
+ long rowCount = (long) queryWrapper.getFieldWrapper("count(*)").getFieldData().get(0);
System.out.printf("%d rows persisted\n", rowCount);
// search and output JSON field
@@ -221,7 +221,7 @@ public static void main(String[] args) {
for (QueryResultsWrapper.RowRecord record : records) {
System.out.println(record);
}
- long pk = (long)records.get(0).get(ID_FIELD);
+ long pk = (long) records.get(0).get(ID_FIELD);
if (pk != i) {
throw new RuntimeException(String.format("The top1 ID %d is not equal to target vector's ID %d", pk, i));
}
diff --git a/examples/src/main/java/io/milvus/v1/NullAndDefaultExample.java b/examples/src/main/java/io/milvus/v1/NullAndDefaultExample.java
index fd845ddf5..1a8569ee0 100644
--- a/examples/src/main/java/io/milvus/v1/NullAndDefaultExample.java
+++ b/examples/src/main/java/io/milvus/v1/NullAndDefaultExample.java
@@ -164,7 +164,7 @@ public static void main(String[] args) {
}
// some values are default value
- if (i%3==0) {
+ if (i % 3 == 0) {
row.addProperty("default_test", 1.0);
}
@@ -197,7 +197,7 @@ public static void main(String[] args) {
.withConsistencyLevel(ConsistencyLevelEnum.STRONG)
.build());
QueryResultsWrapper wrapper = new QueryResultsWrapper(queryRet.getData());
- long rowCount = (long)wrapper.getFieldWrapper("count(*)").getFieldData().get(0);
+ long rowCount = (long) wrapper.getFieldWrapper("count(*)").getFieldData().get(0);
System.out.printf("%d rows in collection\n", rowCount);
// Query by filtering expression
diff --git a/examples/src/main/java/io/milvus/v1/RBACExample.java b/examples/src/main/java/io/milvus/v1/RBACExample.java
index 4ecf5430a..606e06a01 100644
--- a/examples/src/main/java/io/milvus/v1/RBACExample.java
+++ b/examples/src/main/java/io/milvus/v1/RBACExample.java
@@ -37,7 +37,7 @@ public class RBACExample {
ConnectParam connectParam = ConnectParam.newBuilder()
.withHost("localhost")
.withPort(19530)
- .withAuthorization("root","Milvus")
+ .withAuthorization("root", "Milvus")
.build();
milvusClient = new MilvusServiceClient(connectParam);
}
@@ -118,7 +118,7 @@ public static void main(String[] args) {
// grant privilege to role.
// grant object is all collections, grant object type is Collection, and the privilege is CreateCollection
- resp = grantRolePrivilege("role1","Global","*", "CreateCollection");
+ resp = grantRolePrivilege("role1", "Global", "*", "CreateCollection");
Validate.isTrue(resp.getStatus() == R.success().getStatus(), "bind privileges to role fail!");
System.out.println("grant privilege to role1");
@@ -128,7 +128,7 @@ public static void main(String[] args) {
System.out.println("bind role1 to user");
// revoke privilege from role
- resp = revokeRolePrivilege("role1","Global","*", "CreateCollection");
+ resp = revokeRolePrivilege("role1", "Global", "*", "CreateCollection");
Validate.isTrue(resp.getStatus() == R.success().getStatus(), "revoke privileges to role fail!");
System.out.println("revoke privilege from role1");
diff --git a/examples/src/main/java/io/milvus/v1/ResourceGroupExample.java b/examples/src/main/java/io/milvus/v1/ResourceGroupExample.java
index 3b0ae16d6..744558f1f 100644
--- a/examples/src/main/java/io/milvus/v1/ResourceGroupExample.java
+++ b/examples/src/main/java/io/milvus/v1/ResourceGroupExample.java
@@ -20,10 +20,9 @@
package io.milvus.v1;
import com.google.gson.Gson;
-
import io.milvus.client.MilvusServiceClient;
-import io.milvus.v1.resourcegroup.ResourceGroupManagement;
import io.milvus.param.ConnectParam;
+import io.milvus.v1.resourcegroup.ResourceGroupManagement;
public class ResourceGroupExample {
private static final ResourceGroupManagement manager;
diff --git a/examples/src/main/java/io/milvus/v1/SimpleExample.java b/examples/src/main/java/io/milvus/v1/SimpleExample.java
index f6d0717b2..850d8d81e 100644
--- a/examples/src/main/java/io/milvus/v1/SimpleExample.java
+++ b/examples/src/main/java/io/milvus/v1/SimpleExample.java
@@ -22,15 +22,26 @@
import com.google.gson.JsonObject;
import io.milvus.client.MilvusServiceClient;
import io.milvus.common.clientenum.ConsistencyLevelEnum;
-import io.milvus.grpc.*;
+import io.milvus.grpc.DataType;
+import io.milvus.grpc.MutationResult;
+import io.milvus.grpc.QueryResults;
+import io.milvus.grpc.SearchResults;
import io.milvus.param.*;
-import io.milvus.param.collection.*;
-import io.milvus.param.dml.*;
-import io.milvus.param.index.*;
-import io.milvus.response.*;
-import io.milvus.v2.service.vector.response.QueryResp;
-
-import java.util.*;
+import io.milvus.param.collection.CreateCollectionParam;
+import io.milvus.param.collection.DropCollectionParam;
+import io.milvus.param.collection.FieldType;
+import io.milvus.param.collection.LoadCollectionParam;
+import io.milvus.param.dml.InsertParam;
+import io.milvus.param.dml.QueryParam;
+import io.milvus.param.dml.SearchParam;
+import io.milvus.param.index.CreateIndexParam;
+import io.milvus.response.QueryResultsWrapper;
+import io.milvus.response.SearchResultsWrapper;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
public class SimpleExample {
@@ -113,7 +124,7 @@ public static void main(String[] args) {
for (long i = 1L; i <= 10; ++i) {
JsonObject row = new JsonObject();
row.addProperty(ID_FIELD, i);
- List vector = Arrays.asList((float)i, (float)i, (float)i, (float)i);
+ List vector = Arrays.asList((float) i, (float) i, (float) i, (float) i);
row.add(VECTOR_FIELD, gson.toJsonTree(vector));
row.addProperty(TITLE_FIELD, "Tom and Jerry " + i);
rows.add(row);
@@ -135,7 +146,7 @@ public static void main(String[] args) {
.withConsistencyLevel(ConsistencyLevelEnum.STRONG)
.build());
QueryResultsWrapper wrapper = new QueryResultsWrapper(queryRet.getData());
- long rowCount = (long)wrapper.getFieldWrapper("count(*)").getFieldData().get(0);
+ long rowCount = (long) wrapper.getFieldWrapper("count(*)").getFieldData().get(0);
System.out.printf("%d rows persisted\n", rowCount);
// Construct a vector to search top5 similar records, return the book title for us.
@@ -160,11 +171,11 @@ public static void main(String[] args) {
SearchResultsWrapper resultsWrapper = new SearchResultsWrapper(searchRet.getData().getResults());
List scores = resultsWrapper.getIDScore(0);
System.out.println("The result of No.0 target vector:");
- for (SearchResultsWrapper.IDScore score:scores) {
- List vectorReturned = (List)score.get(VECTOR_FIELD);
+ for (SearchResultsWrapper.IDScore score : scores) {
+ List vectorReturned = (List) score.get(VECTOR_FIELD);
System.out.println(vectorReturned);
- String title = (String)score.get(TITLE_FIELD);
+ String title = (String) score.get(TITLE_FIELD);
System.out.println(title);
}
diff --git a/examples/src/main/java/io/milvus/v1/UpsertExample.java b/examples/src/main/java/io/milvus/v1/UpsertExample.java
index 4eb33d234..99399474a 100644
--- a/examples/src/main/java/io/milvus/v1/UpsertExample.java
+++ b/examples/src/main/java/io/milvus/v1/UpsertExample.java
@@ -50,6 +50,7 @@ public class UpsertExample {
.build();
client = new MilvusServiceClient(connectParam);
}
+
private static final String COLLECTION_NAME = "java_sdk_example_upsert_v1";
private static final String ID_FIELD = "pk";
private static final String VECTOR_FIELD = "vector";
diff --git a/examples/src/main/java/io/milvus/v1/resourcegroup/NodeInfo.java b/examples/src/main/java/io/milvus/v1/resourcegroup/NodeInfo.java
index e09415795..35aa87b88 100644
--- a/examples/src/main/java/io/milvus/v1/resourcegroup/NodeInfo.java
+++ b/examples/src/main/java/io/milvus/v1/resourcegroup/NodeInfo.java
@@ -19,14 +19,10 @@
package io.milvus.v1.resourcegroup;
-import lombok.Getter;
-import lombok.NonNull;
-
-@Getter
public class NodeInfo {
- private long nodeId;
- private String address;
- private String hostname;
+ private final long nodeId;
+ private final String address;
+ private final String hostname;
private NodeInfo(Builder builder) {
this.nodeId = builder.nodeId;
@@ -34,6 +30,18 @@ private NodeInfo(Builder builder) {
this.hostname = builder.hostname;
}
+ public long getNodeId() {
+ return nodeId;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public String getHostname() {
+ return hostname;
+ }
+
public static Builder newBuilder() {
return new Builder();
}
@@ -48,12 +56,12 @@ public Builder withNodeId(long nodeId) {
return this;
}
- public Builder withAddress(@NonNull String address) {
+ public Builder withAddress(String address) {
this.address = address;
return this;
}
- public Builder withHostname(@NonNull String hostname) {
+ public Builder withHostname(String hostname) {
this.hostname = hostname;
return this;
}
diff --git a/examples/src/main/java/io/milvus/v1/resourcegroup/ResourceGroupInfo.java b/examples/src/main/java/io/milvus/v1/resourcegroup/ResourceGroupInfo.java
index 10a7f2987..937ce60a8 100644
--- a/examples/src/main/java/io/milvus/v1/resourcegroup/ResourceGroupInfo.java
+++ b/examples/src/main/java/io/milvus/v1/resourcegroup/ResourceGroupInfo.java
@@ -19,23 +19,20 @@
package io.milvus.v1.resourcegroup;
+import io.milvus.common.resourcegroup.ResourceGroupConfig;
+
import java.util.HashSet;
import java.util.Set;
-import io.milvus.common.resourcegroup.ResourceGroupConfig;
-import lombok.Getter;
-import lombok.NonNull;
-
-@Getter
public class ResourceGroupInfo {
private String resourceGroupName;
private ResourceGroupConfig resourceGroupConfig;
private Set fullDatabases; // databases belong to this resource group completely.
private Set partialDatabases; // databases belong to this resource group partially, some collection is in
- // other resource group.
+ // other resource group.
private Set nodes; // actual query node in this resource group.
- private ResourceGroupInfo(@NonNull Builder builder) {
+ private ResourceGroupInfo(Builder builder) {
this.resourceGroupName = builder.resourceGroupName;
this.resourceGroupConfig = builder.resourceGroupConfig;
this.fullDatabases = builder.fullDatabases;
@@ -52,6 +49,26 @@ private ResourceGroupInfo(@NonNull Builder builder) {
}
}
+ public String getResourceGroupName() {
+ return resourceGroupName;
+ }
+
+ public ResourceGroupConfig getResourceGroupConfig() {
+ return resourceGroupConfig;
+ }
+
+ public Set getFullDatabases() {
+ return fullDatabases;
+ }
+
+ public Set getPartialDatabases() {
+ return partialDatabases;
+ }
+
+ public Set getNodes() {
+ return nodes;
+ }
+
public static Builder newBuilder() {
return new Builder();
}
@@ -63,12 +80,12 @@ public static final class Builder {
private Set partialDatabases;
private Set nodes; // actual query node in this resource group.
- public Builder withResourceGroupName(@NonNull String resourceGroupName) {
+ public Builder withResourceGroupName(String resourceGroupName) {
this.resourceGroupName = resourceGroupName;
return this;
}
- public Builder addFullDatabases(@NonNull String databaseName) {
+ public Builder addFullDatabases(String databaseName) {
if (this.fullDatabases == null) {
this.fullDatabases = new HashSet();
}
@@ -76,7 +93,7 @@ public Builder addFullDatabases(@NonNull String databaseName) {
return this;
}
- public Builder addPartialDatabases(@NonNull String databaseName) {
+ public Builder addPartialDatabases(String databaseName) {
if (this.partialDatabases == null) {
this.partialDatabases = new HashSet();
}
@@ -84,7 +101,7 @@ public Builder addPartialDatabases(@NonNull String databaseName) {
return this;
}
- public Builder addAvailableNode(@NonNull NodeInfo node) {
+ public Builder addAvailableNode(NodeInfo node) {
if (this.nodes == null) {
this.nodes = new HashSet();
}
@@ -92,7 +109,7 @@ public Builder addAvailableNode(@NonNull NodeInfo node) {
return this;
}
- public Builder withConfig(@NonNull ResourceGroupConfig resourceGroupConfig) {
+ public Builder withConfig(ResourceGroupConfig resourceGroupConfig) {
this.resourceGroupConfig = resourceGroupConfig;
return this;
}
@@ -104,7 +121,7 @@ public ResourceGroupInfo build() {
/**
* Check if this resource group is the default resource group.
- *
+ *
* @return true if this resource group is the default resource group.
*/
public boolean isDefaultResourceGroup() {
@@ -113,7 +130,7 @@ public boolean isDefaultResourceGroup() {
/**
* Check if this resource group is the recycle resource group.
- *
+ *
* @return true if this resource group is the recycle resource group.
*/
public boolean isRecycleResourceGroup() {
diff --git a/examples/src/main/java/io/milvus/v1/resourcegroup/ResourceGroupManagement.java b/examples/src/main/java/io/milvus/v1/resourcegroup/ResourceGroupManagement.java
index 7c7a3f0fe..7d8ba1508 100644
--- a/examples/src/main/java/io/milvus/v1/resourcegroup/ResourceGroupManagement.java
+++ b/examples/src/main/java/io/milvus/v1/resourcegroup/ResourceGroupManagement.java
@@ -19,36 +19,21 @@
package io.milvus.v1.resourcegroup;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
import io.milvus.client.MilvusClient;
+import io.milvus.common.resourcegroup.ResourceGroupConfig;
+import io.milvus.common.resourcegroup.ResourceGroupLimit;
+import io.milvus.common.resourcegroup.ResourceGroupTransfer;
+import io.milvus.exception.MilvusException;
+import io.milvus.grpc.*;
import io.milvus.param.R;
import io.milvus.param.RpcStatus;
import io.milvus.param.collection.GetLoadStateParam;
import io.milvus.param.collection.ShowCollectionsParam;
import io.milvus.param.control.GetReplicasParam;
-import io.milvus.param.resourcegroup.CreateResourceGroupParam;
-import io.milvus.param.resourcegroup.DescribeResourceGroupParam;
-import io.milvus.param.resourcegroup.DropResourceGroupParam;
-import io.milvus.param.resourcegroup.ListResourceGroupsParam;
-import io.milvus.param.resourcegroup.TransferReplicaParam;
-import io.milvus.param.resourcegroup.UpdateResourceGroupsParam;
-import io.milvus.common.resourcegroup.ResourceGroupConfig;
-import io.milvus.common.resourcegroup.ResourceGroupLimit;
-import io.milvus.common.resourcegroup.ResourceGroupTransfer;
-import io.milvus.exception.MilvusException;
-import io.milvus.grpc.DescribeResourceGroupResponse;
-import io.milvus.grpc.GetLoadStateResponse;
-import io.milvus.grpc.GetReplicasResponse;
-import io.milvus.grpc.ListDatabasesResponse;
-import io.milvus.grpc.ListResourceGroupsResponse;
-import io.milvus.grpc.LoadState;
-import io.milvus.grpc.ShowCollectionsResponse;
+import io.milvus.param.resourcegroup.*;
+
+import java.util.*;
+import java.util.stream.Collectors;
public class ResourceGroupManagement {
@@ -65,7 +50,7 @@ public ResourceGroupManagement(MilvusClient client) {
/**
* list all resource groups.
- *
+ *
* @return map of resource group name and resource group info.
*/
public Map listResourceGroups() throws Exception {
@@ -134,7 +119,7 @@ public Map listResourceGroups() throws Exception {
/**
* Initialize the cluster with a recycle resource group.
- *
+ *
* @param defaultResourceGroupNodeNum The number of query nodes to initialize
* the default resource group.
*/
@@ -173,7 +158,7 @@ public void createResourceGroup(String resourceGroupName, Integer requestNodeNum
/**
* Drop a resource group, before drop resource group, you should scale the
* resource group to 0 first.
- *
+ *
* @param resourceGroupName
*/
public void dropResourceGroup(String resourceGroupName) throws Exception {
@@ -184,7 +169,7 @@ public void dropResourceGroup(String resourceGroupName) throws Exception {
/**
* Scale to the number of nodes in a resource group.
- *
+ *
* @param resourceGroupName
* @param requestNodeNum
*/
@@ -209,7 +194,7 @@ public void scaleResourceGroupTo(String resourceGroupName, Integer requestNodeNu
/**
* Transfer a database to specified resource group.
* Only support single replica now.
- *
+ *
* @param dbName The name of the database to transfer.
* @param resourceGroupName The name of the target resource group.
*/
@@ -238,7 +223,7 @@ public void transferDataBaseToResourceGroup(String dbName, String resourceGroupN
/**
* get the resource group name of the collection.
- *
+ *
* @param dbName
* @param collection
* @return
@@ -278,7 +263,7 @@ private String getCollectionResourceGroupName(String dbName, String collection)
}
/**
- *
+ *
* @param
* @param response
* @return
diff --git a/examples/src/main/java/io/milvus/v2/AddFieldExample.java b/examples/src/main/java/io/milvus/v2/AddFieldExample.java
index 636c813c6..e23be0da9 100644
--- a/examples/src/main/java/io/milvus/v2/AddFieldExample.java
+++ b/examples/src/main/java/io/milvus/v2/AddFieldExample.java
@@ -35,7 +35,9 @@
import io.milvus.v2.service.vector.request.QueryReq;
import io.milvus.v2.service.vector.response.QueryResp;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
public class AddFieldExample {
private static final MilvusClientV2 client;
@@ -46,6 +48,7 @@ public class AddFieldExample {
.build();
client = new MilvusClientV2(config);
}
+
private static final String COLLECTION_NAME = "java_sdk_example_add_field_v2";
private static final String ID_FIELD = "id";
private static final String VECTOR_FIELD = "vector";
diff --git a/examples/src/main/java/io/milvus/v2/ArrayFieldExample.java b/examples/src/main/java/io/milvus/v2/ArrayFieldExample.java
index a8ea79eaf..e9164755a 100644
--- a/examples/src/main/java/io/milvus/v2/ArrayFieldExample.java
+++ b/examples/src/main/java/io/milvus/v2/ArrayFieldExample.java
@@ -126,7 +126,7 @@ public static void main(String[] args) {
List strArray = new ArrayList<>();
int capacity = random.nextInt(5) + 5;
for (int k = 0; k < capacity; k++) {
- intArray.add((i+k)%100);
+ intArray.add((i + k) % 100);
strArray.add(String.format("string-%d-%d", i, k));
}
row.add("array_int32", JsonUtils.toJsonTree(intArray).getAsJsonArray());
@@ -145,7 +145,7 @@ public static void main(String[] args) {
.outputFields(Collections.singletonList("count(*)"))
.consistencyLevel(ConsistencyLevel.STRONG)
.build());
- System.out.printf("%d rows in collection\n", (long)countR.getQueryResults().get(0).getEntity().get("count(*)"));
+ System.out.printf("%d rows in collection\n", (long) countR.getQueryResults().get(0).getEntity().get("count(*)"));
// Query by filtering expression
queryWithExpr(client, "array_int32[0] == 99");
diff --git a/examples/src/main/java/io/milvus/v2/BinaryVectorExample.java b/examples/src/main/java/io/milvus/v2/BinaryVectorExample.java
index a43003b9a..782c74277 100644
--- a/examples/src/main/java/io/milvus/v2/BinaryVectorExample.java
+++ b/examples/src/main/java/io/milvus/v2/BinaryVectorExample.java
@@ -74,8 +74,8 @@ public static void main(String[] args) {
.build());
List indexes = new ArrayList<>();
- Map extraParams = new HashMap<>();
- extraParams.put("nlist",64);
+ Map extraParams = new HashMap<>();
+ extraParams.put("nlist", 64);
indexes.add(IndexParam.builder()
.fieldName(VECTOR_FIELD)
.indexType(IndexParam.IndexType.BIN_IVF_FLAT)
@@ -117,7 +117,7 @@ public static void main(String[] args) {
.outputFields(Collections.singletonList("count(*)"))
.consistencyLevel(ConsistencyLevel.STRONG)
.build());
- System.out.printf("%d rows persisted\n", (long)countR.getQueryResults().get(0).getEntity().get("count(*)"));
+ System.out.printf("%d rows persisted\n", (long) countR.getQueryResults().get(0).getEntity().get("count(*)"));
// Pick some vectors from the inserted vectors to search
// Ensure the returned top1 item's ID should be equal to target vector's ID
@@ -127,8 +127,8 @@ public static void main(String[] args) {
ByteBuffer targetVector = vectors.get(k);
System.out.printf("\nANN search for vector ID=%d:\n", k);
CommonUtils.printBinaryVector(targetVector);
- Map params = new HashMap<>();
- params.put("nprobe",16);
+ Map params = new HashMap<>();
+ params.put("nprobe", 16);
SearchResp searchResp = client.search(SearchReq.builder()
.collectionName(COLLECTION_NAME)
.data(Collections.singletonList(new BinaryVec(targetVector)))
@@ -150,7 +150,7 @@ public static void main(String[] args) {
}
SearchResp.SearchResult firstResult = results.get(0);
- if ((long)firstResult.getId() != k) {
+ if ((long) firstResult.getId() != k) {
throw new RuntimeException(String.format("The top1 ID %d is not equal to target vector's ID %d",
firstResult.getId(), k));
}
diff --git a/examples/src/main/java/io/milvus/v2/CDCExample.java b/examples/src/main/java/io/milvus/v2/CDCExample.java
index 9222297dc..fd2e53cb2 100644
--- a/examples/src/main/java/io/milvus/v2/CDCExample.java
+++ b/examples/src/main/java/io/milvus/v2/CDCExample.java
@@ -74,8 +74,13 @@ public static void main(String[] args) {
.build();
ReplicateConfiguration configuration = ReplicateConfiguration.builder()
- .clusters(new ArrayList(){{ add(milvusClusterA); add(milvusClusterB); }})
- .crossClusterTopologies(new ArrayList(){{ add(topology); }} )
+ .clusters(new ArrayList() {{
+ add(milvusClusterA);
+ add(milvusClusterB);
+ }})
+ .crossClusterTopologies(new ArrayList() {{
+ add(topology);
+ }})
.build();
UpdateReplicateConfigurationReq updateReq = UpdateReplicateConfigurationReq.builder()
diff --git a/examples/src/main/java/io/milvus/v2/ClientPoolExample.java b/examples/src/main/java/io/milvus/v2/ClientPoolExample.java
index b4b90cea0..35f99dcdf 100644
--- a/examples/src/main/java/io/milvus/v2/ClientPoolExample.java
+++ b/examples/src/main/java/io/milvus/v2/ClientPoolExample.java
@@ -57,6 +57,7 @@ private static void printKeyClientNumber(MilvusClientV2Pool pool, String key) {
System.out.printf("Key '%s': %d idle clients and %d active clients%n",
key, pool.getIdleClientNumber(key), pool.getActiveClientNumber(key));
}
+
private static void printClientNumber(MilvusClientV2Pool pool) {
System.out.println("======================================================================");
System.out.printf("Total %d idle clients and %d active clients%n",
@@ -137,7 +138,7 @@ public static Thread runInsertThread(MilvusClientV2Pool pool, String dbName, int
Gson gson = new Gson();
for (int i = 0; i < repeatRequests; i++) {
MilvusClientV2 client = null;
- while(client == null) {
+ while (client == null) {
try {
// getClient() might exceeds the borrowMaxWaitMillis and throw exception
// retry to call until it return a client
@@ -176,7 +177,7 @@ public static Thread runSearchThread(MilvusClientV2Pool pool, String dbName, int
Thread t = new Thread(() -> {
for (int i = 0; i < repeatRequests; i++) {
MilvusClientV2 client = null;
- while(client == null) {
+ while (client == null) {
try {
// getClient() might exceeds the borrowMaxWaitMillis and throw exception
// retry to call until it return a client
@@ -222,7 +223,7 @@ public static void verifyRowCount(MilvusClientV2Pool pool, long expectedCount) {
.outputFields(Collections.singletonList("count(*)"))
.consistencyLevel(ConsistencyLevel.STRONG)
.build());
- long rowCount = (long)countR.getQueryResults().get(0).getEntity().get("count(*)");
+ long rowCount = (long) countR.getQueryResults().get(0).getEntity().get("count(*)");
System.out.printf("%d rows persisted in collection '%s' of database '%s'%n",
rowCount, CollectionName, dbName);
if (rowCount != expectedCount) {
@@ -331,7 +332,7 @@ public static void main(String[] args) throws InterruptedException {
printClientNumber(pool);
// check row count of each collection, there are threadCount*repeatRequests rows were inserted by multiple threads
- verifyRowCount(pool, threadCount*repeatRequests);
+ verifyRowCount(pool, threadCount * repeatRequests);
// drop collections
dropCollections(pool);
// drop databases, only after database is empty, it is able to be dropped
@@ -339,7 +340,7 @@ public static void main(String[] args) throws InterruptedException {
long end = System.currentTimeMillis();
System.out.printf("%d insert requests and %d search requests finished in %.3f seconds%n",
- threadCount*repeatRequests*3, threadCount*repeatRequests*3, (end-start)*0.001);
+ threadCount * repeatRequests * 3, threadCount * repeatRequests * 3, (end - start) * 0.001);
printClientNumber(pool);
pool.clear(); // clear idle clients
diff --git a/examples/src/main/java/io/milvus/v2/ConsistencyLevelExample.java b/examples/src/main/java/io/milvus/v2/ConsistencyLevelExample.java
index d57cf81bd..056953847 100644
--- a/examples/src/main/java/io/milvus/v2/ConsistencyLevelExample.java
+++ b/examples/src/main/java/io/milvus/v2/ConsistencyLevelExample.java
@@ -146,7 +146,7 @@ private static void testSessionLevel() throws Exception {
row.add("vector", gson.toJsonTree(vector));
// insert by a MilvusClient
- String clientName1 = String.format("client_%d", i%10);
+ String clientName1 = String.format("client_%d", i % 10);
MilvusClientV2 client1 = pool.getClient(clientName1);
client1.insert(InsertReq.builder()
.collectionName(collectionName)
@@ -157,7 +157,7 @@ private static void testSessionLevel() throws Exception {
// search by another MilvusClient, use the just inserted vector to search
// the returned item is expected to be the just inserted item
- String clientName2 = String.format("client_%d", i%10+1);
+ String clientName2 = String.format("client_%d", i % 10 + 1);
MilvusClientV2 client2 = pool.getClient(clientName2);
SearchResp searchR = client2.search(SearchReq.builder()
.collectionName(collectionName)
@@ -170,7 +170,7 @@ private static void testSessionLevel() throws Exception {
if (results.size() != 1) {
throw new RuntimeException("Search result is empty");
}
- if (i != (Long)results.get(0).getId()) {
+ if (i != (Long) results.get(0).getId()) {
throw new RuntimeException("The just inserted entity is not found");
}
System.out.println("search");
diff --git a/examples/src/main/java/io/milvus/v2/Float16VectorExample.java b/examples/src/main/java/io/milvus/v2/Float16VectorExample.java
index 6281e5305..4368c4ae0 100644
--- a/examples/src/main/java/io/milvus/v2/Float16VectorExample.java
+++ b/examples/src/main/java/io/milvus/v2/Float16VectorExample.java
@@ -52,6 +52,7 @@ public class Float16VectorExample {
private static final Integer VECTOR_DIM = 128;
private static final MilvusClientV2 client;
+
static {
client = new MilvusClientV2(ConnectConfig.builder()
.uri("http://localhost:19530")
@@ -162,7 +163,7 @@ private static void searchVectors(List taargetIDs, List target
}
Map entity = topResult.getEntity();
ByteBuffer vectorBuf = (ByteBuffer) entity.get(vectorFieldName);
- ByteBuffer targetVectorBuf = (ByteBuffer)targetVectors.get(i).getData();
+ ByteBuffer targetVectorBuf = (ByteBuffer) targetVectors.get(i).getData();
if (!vectorBuf.equals(targetVectorBuf)) {
throw new RuntimeException("The top1 output vector is incorrect");
}
diff --git a/examples/src/main/java/io/milvus/v2/FullTextSearchExample.java b/examples/src/main/java/io/milvus/v2/FullTextSearchExample.java
index 03d43db75..b92e8f4e4 100644
--- a/examples/src/main/java/io/milvus/v2/FullTextSearchExample.java
+++ b/examples/src/main/java/io/milvus/v2/FullTextSearchExample.java
@@ -29,8 +29,8 @@
import io.milvus.v2.common.IndexParam;
import io.milvus.v2.service.collection.request.AddFieldReq;
import io.milvus.v2.service.collection.request.CreateCollectionReq;
-import io.milvus.v2.service.collection.request.DropCollectionReq;
import io.milvus.v2.service.collection.request.CreateCollectionReq.Function;
+import io.milvus.v2.service.collection.request.DropCollectionReq;
import io.milvus.v2.service.vector.request.InsertReq;
import io.milvus.v2.service.vector.request.QueryReq;
import io.milvus.v2.service.vector.request.SearchReq;
@@ -38,7 +38,10 @@
import io.milvus.v2.service.vector.response.QueryResp;
import io.milvus.v2.service.vector.response.SearchResp;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
public class FullTextSearchExample {
private static final String COLLECTION_NAME = "java_sdk_example_text_match_v2";
@@ -146,7 +149,7 @@ public static void main(String[] args) {
.outputFields(Collections.singletonList("count(*)"))
.consistencyLevel(ConsistencyLevel.STRONG)
.build());
- System.out.printf("%d rows in collection\n", (long)countR.getQueryResults().get(0).getEntity().get("count(*)"));
+ System.out.printf("%d rows in collection\n", (long) countR.getQueryResults().get(0).getEntity().get("count(*)"));
// Query by filtering expression
searchByText(client, "moon and earth distance");
diff --git a/examples/src/main/java/io/milvus/v2/GeneralExample.java b/examples/src/main/java/io/milvus/v2/GeneralExample.java
index e20d4af02..458729725 100644
--- a/examples/src/main/java/io/milvus/v2/GeneralExample.java
+++ b/examples/src/main/java/io/milvus/v2/GeneralExample.java
@@ -27,12 +27,7 @@
import io.milvus.v2.common.ConsistencyLevel;
import io.milvus.v2.common.DataType;
import io.milvus.v2.common.IndexParam;
-import io.milvus.v2.service.collection.request.AddFieldReq;
-import io.milvus.v2.service.collection.request.CreateCollectionReq;
-import io.milvus.v2.service.collection.request.DescribeCollectionReq;
-import io.milvus.v2.service.collection.request.DropCollectionReq;
-import io.milvus.v2.service.collection.request.LoadCollectionReq;
-import io.milvus.v2.service.collection.request.ReleaseCollectionReq;
+import io.milvus.v2.service.collection.request.*;
import io.milvus.v2.service.collection.response.DescribeCollectionResp;
import io.milvus.v2.service.collection.response.ListCollectionsResp;
import io.milvus.v2.service.partition.request.CreatePartitionReq;
@@ -44,15 +39,11 @@
import io.milvus.v2.service.vector.response.InsertResp;
import io.milvus.v2.service.vector.response.SearchResp;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
+import java.util.*;
public class GeneralExample {
private static final MilvusClientV2 client;
+
static {
client = new MilvusClientV2(ConnectConfig.builder()
.uri("http://localhost:19530")
@@ -96,8 +87,8 @@ private static void createCollection() {
.build());
List indexes = new ArrayList<>();
- Map extraParams = new HashMap<>();
- extraParams.put("nlist",128);
+ Map extraParams = new HashMap<>();
+ extraParams.put("nlist", 128);
indexes.add(IndexParam.builder()
.fieldName(VECTOR_FIELD)
.indexName(INDEX_NAME)
@@ -193,8 +184,8 @@ private static void searchFace(String filter) {
}
long begin = System.currentTimeMillis();
- Map params = new HashMap<>();
- params.put("nprobe",10);
+ Map params = new HashMap<>();
+ params.put("nprobe", 10);
SearchResp resp = client.search(SearchReq.builder()
.collectionName(COLLECTION_NAME)
.limit(SEARCH_K)
diff --git a/examples/src/main/java/io/milvus/v2/GeometryExample.java b/examples/src/main/java/io/milvus/v2/GeometryExample.java
index a1b529bf1..e7f6ca526 100644
--- a/examples/src/main/java/io/milvus/v2/GeometryExample.java
+++ b/examples/src/main/java/io/milvus/v2/GeometryExample.java
@@ -36,10 +36,13 @@
import io.milvus.v2.service.vector.request.QueryReq;
import io.milvus.v2.service.vector.response.QueryResp;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
public class GeometryExample {
private static final MilvusClientV2 client;
+
static {
client = new MilvusClientV2(ConnectConfig.builder()
.uri("http://localhost:19530")
@@ -120,7 +123,7 @@ private static void printRowCount() {
.outputFields(Collections.singletonList("count(*)"))
.consistencyLevel(ConsistencyLevel.STRONG)
.build());
- System.out.printf("%d rows persisted\n", (long)countR.getQueryResults().get(0).getEntity().get("count(*)"));
+ System.out.printf("%d rows persisted\n", (long) countR.getQueryResults().get(0).getEntity().get("count(*)"));
}
private static void query(String filter) {
diff --git a/examples/src/main/java/io/milvus/v2/HybridSearchExample.java b/examples/src/main/java/io/milvus/v2/HybridSearchExample.java
index ab729e239..fd90e56d9 100644
--- a/examples/src/main/java/io/milvus/v2/HybridSearchExample.java
+++ b/examples/src/main/java/io/milvus/v2/HybridSearchExample.java
@@ -21,20 +21,16 @@
import com.google.gson.Gson;
import com.google.gson.JsonObject;
-import io.milvus.v2.common.DataType;
import io.milvus.v1.CommonUtils;
import io.milvus.v2.client.ConnectConfig;
import io.milvus.v2.client.MilvusClientV2;
import io.milvus.v2.common.ConsistencyLevel;
+import io.milvus.v2.common.DataType;
import io.milvus.v2.common.IndexParam;
import io.milvus.v2.service.collection.request.AddFieldReq;
import io.milvus.v2.service.collection.request.CreateCollectionReq;
import io.milvus.v2.service.collection.request.DropCollectionReq;
-import io.milvus.v2.service.vector.request.AnnSearchReq;
-import io.milvus.v2.service.vector.request.FunctionScore;
-import io.milvus.v2.service.vector.request.HybridSearchReq;
-import io.milvus.v2.service.vector.request.InsertReq;
-import io.milvus.v2.service.vector.request.QueryReq;
+import io.milvus.v2.service.vector.request.*;
import io.milvus.v2.service.vector.request.data.BaseVector;
import io.milvus.v2.service.vector.request.data.BinaryVec;
import io.milvus.v2.service.vector.request.data.FloatVec;
@@ -107,10 +103,10 @@ private static void createCollection() {
.build());
List indexes = new ArrayList<>();
- Map fvParams = new HashMap<>();
- fvParams.put("nlist",128);
- fvParams.put("m",16);
- fvParams.put("nbits",8);
+ Map fvParams = new HashMap<>();
+ fvParams.put("nlist", 128);
+ fvParams.put("m", 16);
+ fvParams.put("nbits", 8);
indexes.add(IndexParam.builder()
.fieldName(FLOAT_VECTOR_FIELD)
.indexType(IndexParam.IndexType.IVF_PQ)
@@ -122,9 +118,9 @@ private static void createCollection() {
.indexType(IndexParam.IndexType.BIN_FLAT)
.metricType(BINARY_VECTOR_METRIC)
.build());
- Map fv16Params = new HashMap<>();
- fv16Params.put("M",16);
- fv16Params.put("efConstruction",64);
+ Map fv16Params = new HashMap<>();
+ fv16Params.put("M", 16);
+ fv16Params.put("efConstruction", 64);
indexes.add(IndexParam.builder()
.fieldName(FLOAT16_VECTOR_FIELD)
.indexType(IndexParam.IndexType.HNSW)
@@ -177,7 +173,7 @@ private static void printRowCount() {
.outputFields(Collections.singletonList("count(*)"))
.consistencyLevel(ConsistencyLevel.STRONG)
.build());
- System.out.printf("%d rows persisted\n", (long)countR.getQueryResults().get(0).getEntity().get("count(*)"));
+ System.out.printf("%d rows persisted\n", (long) countR.getQueryResults().get(0).getEntity().get("count(*)"));
}
private static void hybridSearch() {
diff --git a/examples/src/main/java/io/milvus/v2/Int8VectorExample.java b/examples/src/main/java/io/milvus/v2/Int8VectorExample.java
index 5d6ed4481..828e11b75 100644
--- a/examples/src/main/java/io/milvus/v2/Int8VectorExample.java
+++ b/examples/src/main/java/io/milvus/v2/Int8VectorExample.java
@@ -21,7 +21,6 @@
import com.google.gson.Gson;
import com.google.gson.JsonObject;
-import io.milvus.v1.CommonUtils;
import io.milvus.v2.client.ConnectConfig;
import io.milvus.v2.client.MilvusClientV2;
import io.milvus.v2.common.ConsistencyLevel;
@@ -33,7 +32,6 @@
import io.milvus.v2.service.vector.request.InsertReq;
import io.milvus.v2.service.vector.request.QueryReq;
import io.milvus.v2.service.vector.request.SearchReq;
-import io.milvus.v2.service.vector.request.data.BinaryVec;
import io.milvus.v2.service.vector.request.data.Int8Vec;
import io.milvus.v2.service.vector.response.QueryResp;
import io.milvus.v2.service.vector.response.SearchResp;
@@ -89,7 +87,7 @@ public static void main(String[] args) {
.build());
List indexes = new ArrayList<>();
- Map extraParams = new HashMap<>();
+ Map extraParams = new HashMap<>();
extraParams.put("M", 64);
extraParams.put("efConstruction", 200);
indexes.add(IndexParam.builder()
@@ -116,7 +114,7 @@ public static void main(String[] args) {
for (long i = 0L; i < rowCount; ++i) {
JsonObject row = new JsonObject();
row.addProperty(ID_FIELD, i);
- ByteBuffer vector = vectors.get((int)i);
+ ByteBuffer vector = vectors.get((int) i);
row.add(VECTOR_FIELD, gson.toJsonTree(vector.array()));
rows.add(row);
}
@@ -132,7 +130,7 @@ public static void main(String[] args) {
.outputFields(Collections.singletonList("count(*)"))
.consistencyLevel(ConsistencyLevel.STRONG)
.build());
- System.out.printf("%d rows persisted\n", (long)countR.getQueryResults().get(0).getEntity().get("count(*)"));
+ System.out.printf("%d rows persisted\n", (long) countR.getQueryResults().get(0).getEntity().get("count(*)"));
// Pick some vectors from the inserted vectors to search
// Ensure the returned top1 item's ID should be equal to target vector's ID
@@ -160,9 +158,9 @@ public static void main(String[] args) {
}
SearchResp.SearchResult firstResult = results.get(0);
- if ((long)firstResult.getId() != k) {
+ if ((long) firstResult.getId() != k) {
throw new RuntimeException(String.format("The top1 ID %d is not equal to target vector's ID %d",
- (long)firstResult.getId(), k));
+ (long) firstResult.getId(), k));
}
}
System.out.println("Search result is correct");
diff --git a/examples/src/main/java/io/milvus/v2/IteratorExample.java b/examples/src/main/java/io/milvus/v2/IteratorExample.java
index 7fae70b5e..d7791313d 100644
--- a/examples/src/main/java/io/milvus/v2/IteratorExample.java
+++ b/examples/src/main/java/io/milvus/v2/IteratorExample.java
@@ -47,11 +47,13 @@
public class IteratorExample {
private static final MilvusClientV2 client;
+
static {
client = new MilvusClientV2(ConnectConfig.builder()
.uri("http://localhost:19530")
.build());
}
+
private static final String COLLECTION_NAME = "java_sdk_example_iterator_v2";
private static final String ID_FIELD = "userID";
private static final String AGE_FIELD = "userAge";
@@ -200,7 +202,7 @@ private static void searchIteratorV2(String filter, Map params,
Function, List> externalFilterFunc) {
System.out.println("\n========== searchIteratorV2() ==========");
System.out.println(String.format("expr='%s', params='%s', batchSize=%d, topK=%d",
- filter, params==null ? "" : params.toString(), batchSize, topK));
+ filter, params == null ? "" : params.toString(), batchSize, topK));
SearchIteratorV2 searchIterator = client.searchIteratorV2(SearchIteratorReqV2.builder()
.collectionName(COLLECTION_NAME)
.outputFields(Lists.newArrayList(AGE_FIELD))
@@ -208,7 +210,7 @@ private static void searchIteratorV2(String filter, Map params,
.vectorFieldName(VECTOR_FIELD)
.vectors(Collections.singletonList(new FloatVec(CommonUtils.generateFloatVector(VECTOR_DIM))))
.filter(filter)
- .searchParams(params==null ? new HashMap<>() : params)
+ .searchParams(params == null ? new HashMap<>() : params)
.limit(topK)
.metricType(IndexParam.MetricType.L2)
.consistencyLevel(ConsistencyLevel.BOUNDED)
@@ -235,21 +237,21 @@ private static void searchIteratorV2(String filter, Map params,
public static void main(String[] args) {
buildCollection();
- queryIterator("userID < 300",50, 5,400);
+ queryIterator("userID < 300", 50, 5, 400);
searchIteratorV1("userAge > 50 &&userAge < 100", "{\"range_filter\": 15.0, \"radius\": 20.0}", 100, 500);
searchIteratorV1("", "", 10, 99);
searchIteratorV2("userAge > 10 &&userAge < 20", null, 50, 120, null);
- Map extraParams = new HashMap<>();
- extraParams.put("radius",15.0);
+ Map extraParams = new HashMap<>();
+ extraParams.put("radius", 15.0);
searchIteratorV2("", extraParams, 50, 100, null);
// use external function to filter the result
- Function, List> externalFilterFunc = (List src)->{
+ Function, List> externalFilterFunc = (List src) -> {
List newRes = new ArrayList<>();
for (SearchResp.SearchResult res : src) {
- long id = (long)res.getId();
- if (id%2 == 0) {
+ long id = (long) res.getId();
+ if (id % 2 == 0) {
newRes.add(res);
}
}
diff --git a/examples/src/main/java/io/milvus/v2/JsonFieldExample.java b/examples/src/main/java/io/milvus/v2/JsonFieldExample.java
index 6dca633b4..2818776cd 100644
--- a/examples/src/main/java/io/milvus/v2/JsonFieldExample.java
+++ b/examples/src/main/java/io/milvus/v2/JsonFieldExample.java
@@ -101,7 +101,7 @@ public static void main(String[] args) {
// Create INVERTED index for a specific entry of JSON field
// Index for JSON field is supported from milvus v2.5.7 and fully supported in v2.5.13+
// Read the doc for more info: https://milvus.io/docs/json-indexing.md
- Map p1 = new HashMap<>();
+ Map p1 = new HashMap<>();
p1.put("json_path", "metadata[\"flags\"]");
p1.put("json_cast_type", "array_double");
indexes.add(IndexParam.builder()
@@ -113,8 +113,8 @@ public static void main(String[] args) {
// Create NGRAM index for a specific entry of JSON field
// NGRAM index for JSON field is supported from milvus v2.6.2
// Read the doc for more info: https://milvus.io/docs/ngram.md
- Map p2 = new HashMap<>();
- p2.put("json_path","metadata[\"path\"]");
+ Map p2 = new HashMap<>();
+ p2.put("json_path", "metadata[\"path\"]");
p2.put("json_cast_type", "varchar");
p2.put("min_gram", 3);
p2.put("max_gram", 5);
@@ -149,7 +149,7 @@ public static void main(String[] args) {
JsonObject metadata = new JsonObject();
metadata.addProperty("path", String.format("\\root/abc_%d/path_%d", i, i));
metadata.addProperty("size", i);
- if (i%7 == 0) {
+ if (i % 7 == 0) {
metadata.addProperty("special", true);
}
metadata.add("flags", gson.toJsonTree(Arrays.asList(i, i + 1, i + 2)));
@@ -158,8 +158,8 @@ public static void main(String[] args) {
// System.out.println(metadata);
// dynamic fields
- if (i%2 == 0) {
- row.addProperty("dynamic1", (double)i/3);
+ if (i % 2 == 0) {
+ row.addProperty("dynamic1", (double) i / 3);
} else {
row.addProperty("dynamic2", "ok");
}
@@ -176,7 +176,7 @@ public static void main(String[] args) {
.outputFields(Collections.singletonList("count(*)"))
.consistencyLevel(ConsistencyLevel.STRONG)
.build());
- System.out.printf("%d rows persisted\n", (long)countR.getQueryResults().get(0).getEntity().get("count(*)"));
+ System.out.printf("%d rows persisted\n", (long) countR.getQueryResults().get(0).getEntity().get("count(*)"));
// Search and output JSON field
List searchVectors = new ArrayList<>();
@@ -203,7 +203,7 @@ public static void main(String[] args) {
System.out.println(result);
}
- long pk = (long)results.get(0).getId();
+ long pk = (long) results.get(0).getId();
if (pk != i) {
throw new RuntimeException(String.format("The top1 ID %d is not equal to target vector's ID %d", pk, i));
}
@@ -213,7 +213,7 @@ public static void main(String[] args) {
metadata, expectedMetadatas.get(i)));
}
List vector = (List) results.get(0).getEntity().get(VECTOR_FIELD);
- CommonUtils.compareFloatVectors(vector, (List)searchVectors.get(i).getData());
+ CommonUtils.compareFloatVectors(vector, (List) searchVectors.get(i).getData());
}
// Query by filtering JSON
diff --git a/examples/src/main/java/io/milvus/v2/NullAndDefaultExample.java b/examples/src/main/java/io/milvus/v2/NullAndDefaultExample.java
index d2b50876a..cd7c9a96d 100644
--- a/examples/src/main/java/io/milvus/v2/NullAndDefaultExample.java
+++ b/examples/src/main/java/io/milvus/v2/NullAndDefaultExample.java
@@ -35,7 +35,10 @@
import io.milvus.v2.service.vector.request.QueryReq;
import io.milvus.v2.service.vector.response.QueryResp;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
public class NullAndDefaultExample {
private static final String COLLECTION_NAME = "java_sdk_example_nullable_v2";
@@ -144,7 +147,7 @@ public static void main(String[] args) {
}
// some values are default value
- if (i%3==0) {
+ if (i % 3 == 0) {
row.addProperty("default_test", 1.0);
}
@@ -172,7 +175,7 @@ public static void main(String[] args) {
.outputFields(Collections.singletonList("count(*)"))
.consistencyLevel(ConsistencyLevel.STRONG)
.build());
- System.out.printf("%d rows in collection\n", (long)countR.getQueryResults().get(0).getEntity().get("count(*)"));
+ System.out.printf("%d rows in collection\n", (long) countR.getQueryResults().get(0).getEntity().get("count(*)"));
// Query by filtering expression
queryWithExpr(client, "id >= 0"); // show all items
diff --git a/examples/src/main/java/io/milvus/v2/RankerExample.java b/examples/src/main/java/io/milvus/v2/RankerExample.java
index 46ac8ac9e..2e325afb9 100644
--- a/examples/src/main/java/io/milvus/v2/RankerExample.java
+++ b/examples/src/main/java/io/milvus/v2/RankerExample.java
@@ -39,7 +39,10 @@
import io.milvus.v2.service.vector.response.QueryResp;
import io.milvus.v2.service.vector.response.SearchResp;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
public class RankerExample {
private static final MilvusClientV2 client;
@@ -61,6 +64,7 @@ private static class Person {
public String name;
public int fromYear;
public int toYear;
+
public Person(String name, int from, int to) {
this.name = name;
this.fromYear = from;
@@ -186,7 +190,7 @@ private static void printRowCount() {
.outputFields(Collections.singletonList("count(*)"))
.consistencyLevel(ConsistencyLevel.STRONG)
.build());
- System.out.printf("%d rows persisted\n", (long)countR.getQueryResults().get(0).getEntity().get("count(*)"));
+ System.out.printf("%d rows persisted\n", (long) countR.getQueryResults().get(0).getEntity().get("count(*)"));
}
private static void dropCollection() {
diff --git a/examples/src/main/java/io/milvus/v2/SimpleExample.java b/examples/src/main/java/io/milvus/v2/SimpleExample.java
index 25fbcbe4c..d30859aa1 100644
--- a/examples/src/main/java/io/milvus/v2/SimpleExample.java
+++ b/examples/src/main/java/io/milvus/v2/SimpleExample.java
@@ -19,14 +19,22 @@
package io.milvus.v2;
-import com.google.gson.*;
-import io.milvus.v2.client.*;
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import io.milvus.v2.client.ConnectConfig;
+import io.milvus.v2.client.MilvusClientV2;
import io.milvus.v2.common.ConsistencyLevel;
import io.milvus.v2.service.collection.request.CreateCollectionReq;
import io.milvus.v2.service.collection.request.DropCollectionReq;
-import io.milvus.v2.service.vector.request.*;
+import io.milvus.v2.service.vector.request.GetReq;
+import io.milvus.v2.service.vector.request.InsertReq;
+import io.milvus.v2.service.vector.request.QueryReq;
+import io.milvus.v2.service.vector.request.SearchReq;
import io.milvus.v2.service.vector.request.data.FloatVec;
-import io.milvus.v2.service.vector.response.*;
+import io.milvus.v2.service.vector.response.GetResp;
+import io.milvus.v2.service.vector.response.InsertResp;
+import io.milvus.v2.service.vector.response.QueryResp;
+import io.milvus.v2.service.vector.response.SearchResp;
import java.util.*;
@@ -57,7 +65,7 @@ public static void main(String[] args) {
for (int i = 0; i < 100; i++) {
JsonObject row = new JsonObject();
row.addProperty("id", i);
- row.add("vector", gson.toJsonTree(new float[]{i, (float) i /2, (float) i /3, (float) i /4}));
+ row.add("vector", gson.toJsonTree(new float[]{i, (float) i / 2, (float) i / 3, (float) i / 4}));
row.addProperty(String.format("dynamic_%d", i), "this is dynamic value"); // this value is stored in dynamic field
rows.add(row);
}
@@ -73,7 +81,7 @@ public static void main(String[] args) {
.outputFields(Collections.singletonList("count(*)"))
.consistencyLevel(ConsistencyLevel.STRONG)
.build());
- System.out.printf("%d rows persisted\n", (long)countR.getQueryResults().get(0).getEntity().get("count(*)"));
+ System.out.printf("%d rows persisted\n", (long) countR.getQueryResults().get(0).getEntity().get("count(*)"));
// Retrieve
List
-
- org.projectlombok
- lombok
- ${lombok.version}
- provided
-
org.apache.parquet
parquet-avro
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/BulkWriter.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/BulkWriter.java
index 897c41586..d23a78dec 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/BulkWriter.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/BulkWriter.java
@@ -127,7 +127,7 @@ private void createWriterByType() throws IOException {
switch (fileType) {
case PARQUET:
- this.fileWriter = new ParquetFileWriter(collectionSchema, filePathPrefix.toString());
+ this.fileWriter = new ParquetFileWriter(collectionSchema, filePathPrefix.toString());
break;
case JSON:
this.fileWriter = new JSONFileWriter(collectionSchema, filePathPrefix.toString());
@@ -223,7 +223,7 @@ protected Map verifyRow(JsonObject row) {
}
JsonElement obj = row.get(fieldName);
- if (obj == null ) {
+ if (obj == null) {
obj = JsonNull.INSTANCE;
}
if (outputFieldNames.contains(fieldName)) {
@@ -288,7 +288,7 @@ protected Map verifyRow(JsonObject row) {
case Float16Vector:
case BFloat16Vector:
case SparseFloatVector:
- case Int8Vector:{
+ case Int8Vector: {
Pair objectAndSize = verifyVector(obj, field);
rowValues.put(fieldName, objectAndSize.getLeft());
rowSize += objectAndSize.getRight();
@@ -369,21 +369,21 @@ private Pair verifyVector(JsonElement object, CreateCollectionR
return Pair.of(vector, ((List>) vector).size() * 4);
case BinaryVector:
case Int8Vector:
- return Pair.of(vector, ((ByteBuffer)vector).limit());
+ return Pair.of(vector, ((ByteBuffer) vector).limit());
case Float16Vector:
case BFloat16Vector:
// for JSON and CSV, float16/bfloat16 vector is parsed as float values in text
if (this.fileType == BulkFileType.CSV || this.fileType == BulkFileType.JSON) {
- ByteBuffer bv = (ByteBuffer)vector;
+ ByteBuffer bv = (ByteBuffer) vector;
bv.order(ByteOrder.LITTLE_ENDIAN); // ensure LITTLE_ENDIAN
List v = (dataType == DataType.Float16Vector) ?
Float16Utils.fp16BufferToVector(bv) : Float16Utils.bf16BufferToVector(bv);
return Pair.of(v, v.size() * 4);
}
// for PARQUET, float16/bfloat16 vector is parsed as binary
- return Pair.of(vector, ((ByteBuffer)vector).limit() * 2);
+ return Pair.of(vector, ((ByteBuffer) vector).limit() * 2);
case SparseFloatVector:
- return Pair.of(vector, ((SortedMap)vector).size() * 12);
+ return Pair.of(vector, ((SortedMap) vector).size() * 12);
default:
ExceptionUtils.throwUnExpectedException("Unknown vector type");
}
@@ -417,7 +417,7 @@ private Pair verifyArray(JsonElement object, CreateCollectionRe
int rowSize = 0;
DataType elementType = field.getElementType();
if (TypeSize.contains(elementType)) {
- rowSize = TypeSize.getSize(elementType) * ((List>)array).size();
+ rowSize = TypeSize.getSize(elementType) * ((List>) array).size();
} else if (elementType == DataType.VarChar) {
for (String str : (List) array) {
rowSize += str.length();
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/LocalBulkWriter.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/LocalBulkWriter.java
index 04fba4806..52dc55d3e 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/LocalBulkWriter.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/LocalBulkWriter.java
@@ -41,9 +41,9 @@
public class LocalBulkWriter extends BulkWriter {
private static final Logger logger = LoggerFactory.getLogger(LocalBulkWriter.class);
- private Map workingThread;
- private ReentrantLock workingThreadLock;
- private List> localFiles;
+ private final Map workingThread;
+ private final ReentrantLock workingThreadLock;
+ private final List> localFiles;
public LocalBulkWriter(LocalBulkWriterParam bulkWriterParam) throws IOException {
super(bulkWriterParam.getCollectionSchema(), bulkWriterParam.getChunkSize(), bulkWriterParam.getFileType(), bulkWriterParam.getLocalPath(), bulkWriterParam.getConfig());
@@ -93,7 +93,7 @@ protected List commitIfFileReady(boolean createNewFile) {
String filePath = super.getFileWriter().getFilePath();
String msg = String.format("Prepare to commit file:%s, current_file_total_row_count: %s, current_file_total_size:%s, create_new_file:%s",
- filePath ,super.getTotalRowCount(), super.getTotalSize(), createNewFile);
+ filePath, super.getTotalRowCount(), super.getTotalSize(), createNewFile);
logger.info(msg);
List fileList = Lists.newArrayList(filePath);
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/LocalBulkWriterParam.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/LocalBulkWriterParam.java
index 2bdc00a98..638c4bf6e 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/LocalBulkWriterParam.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/LocalBulkWriterParam.java
@@ -25,9 +25,6 @@
import io.milvus.param.ParamUtils;
import io.milvus.param.collection.CollectionSchemaParam;
import io.milvus.v2.service.collection.request.CreateCollectionReq;
-import lombok.Getter;
-import lombok.NonNull;
-import lombok.ToString;
import java.util.HashMap;
import java.util.Map;
@@ -35,8 +32,6 @@
/**
* Parameters for bulkWriter interface.
*/
-@Getter
-@ToString
public class LocalBulkWriterParam {
private final CreateCollectionReq.CollectionSchema collectionSchema;
private final String localPath;
@@ -44,7 +39,7 @@ public class LocalBulkWriterParam {
private final BulkFileType fileType;
private final Map config;
- private LocalBulkWriterParam(@NonNull Builder builder) {
+ private LocalBulkWriterParam(Builder builder) {
this.collectionSchema = builder.collectionSchema;
this.localPath = builder.localPath;
this.chunkSize = builder.chunkSize;
@@ -52,6 +47,36 @@ private LocalBulkWriterParam(@NonNull Builder builder) {
this.config = builder.config;
}
+ public CreateCollectionReq.CollectionSchema getCollectionSchema() {
+ return collectionSchema;
+ }
+
+ public String getLocalPath() {
+ return localPath;
+ }
+
+ public long getChunkSize() {
+ return chunkSize;
+ }
+
+ public BulkFileType getFileType() {
+ return fileType;
+ }
+
+ public Map getConfig() {
+ return config;
+ }
+
+ @Override
+ public String toString() {
+ return "LocalBulkWriterParam{" +
+ "collectionSchema=" + collectionSchema +
+ ", localPath='" + localPath + '\'' +
+ ", chunkSize=" + chunkSize +
+ ", fileType=" + fileType +
+ '}';
+ }
+
public static Builder newBuilder() {
return new Builder();
}
@@ -64,7 +89,7 @@ public static final class Builder {
private String localPath;
private long chunkSize = 128 * 1024 * 1024;
private BulkFileType fileType = BulkFileType.PARQUET;
- private Map config = new HashMap<>();
+ private final Map config = new HashMap<>();
private Builder() {
}
@@ -75,7 +100,7 @@ private Builder() {
* @param collectionSchema collection schema
* @return Builder
*/
- public Builder withCollectionSchema(@NonNull CollectionSchemaParam collectionSchema) {
+ public Builder withCollectionSchema(CollectionSchemaParam collectionSchema) {
this.collectionSchema = V2AdapterUtils.convertV1Schema(collectionSchema);
return this;
}
@@ -86,7 +111,7 @@ public Builder withCollectionSchema(@NonNull CollectionSchemaParam collectionSch
* @param collectionSchema collection schema
* @return Builder
*/
- public Builder withCollectionSchema(@NonNull CreateCollectionReq.CollectionSchema collectionSchema) {
+ public Builder withCollectionSchema(CreateCollectionReq.CollectionSchema collectionSchema) {
this.collectionSchema = collectionSchema;
return this;
}
@@ -97,7 +122,7 @@ public Builder withCollectionSchema(@NonNull CreateCollectionReq.CollectionSchem
* @param localPath collection name
* @return Builder
*/
- public Builder withLocalPath(@NonNull String localPath) {
+ public Builder withLocalPath(String localPath) {
this.localPath = localPath;
return this;
}
@@ -132,5 +157,4 @@ public LocalBulkWriterParam build() throws ParamException {
return new LocalBulkWriterParam(this);
}
}
-
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/RemoteBulkWriter.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/RemoteBulkWriter.java
index 98a418037..2564287ca 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/RemoteBulkWriter.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/RemoteBulkWriter.java
@@ -47,11 +47,11 @@
public class RemoteBulkWriter extends LocalBulkWriter {
private static final Logger logger = LoggerFactory.getLogger(RemoteBulkWriter.class);
- private String remotePath;
- private StorageConnectParam connectParam;
+ private final String remotePath;
+ private final StorageConnectParam connectParam;
private StorageClient storageClient;
- private List> remoteFiles;
+ private final List> remoteFiles;
public RemoteBulkWriter(RemoteBulkWriterParam bulkWriterParam) throws IOException {
super(bulkWriterParam.getCollectionSchema(),
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/RemoteBulkWriterParam.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/RemoteBulkWriterParam.java
index 9c88973a1..b82fce6e5 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/RemoteBulkWriterParam.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/RemoteBulkWriterParam.java
@@ -19,17 +19,13 @@
package io.milvus.bulkwriter;
+import io.milvus.bulkwriter.common.clientenum.BulkFileType;
import io.milvus.bulkwriter.common.utils.V2AdapterUtils;
import io.milvus.bulkwriter.connect.StorageConnectParam;
-import io.milvus.bulkwriter.common.clientenum.BulkFileType;
import io.milvus.exception.ParamException;
import io.milvus.param.ParamUtils;
import io.milvus.param.collection.CollectionSchemaParam;
import io.milvus.v2.service.collection.request.CreateCollectionReq;
-import lombok.Getter;
-import lombok.NonNull;
-import lombok.ToString;
-import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Map;
@@ -37,8 +33,6 @@
/**
* Parameters for bulkWriter interface.
*/
-@Getter
-@ToString
public class RemoteBulkWriterParam {
private final CreateCollectionReq.CollectionSchema collectionSchema;
private final StorageConnectParam connectParam;
@@ -47,7 +41,7 @@ public class RemoteBulkWriterParam {
private final BulkFileType fileType;
private final Map config;
- private RemoteBulkWriterParam(@NonNull Builder builder) {
+ private RemoteBulkWriterParam(Builder builder) {
this.collectionSchema = builder.collectionSchema;
this.connectParam = builder.connectParam;
this.remotePath = builder.remotePath;
@@ -56,6 +50,40 @@ private RemoteBulkWriterParam(@NonNull Builder builder) {
this.config = builder.config;
}
+ public CreateCollectionReq.CollectionSchema getCollectionSchema() {
+ return collectionSchema;
+ }
+
+ public StorageConnectParam getConnectParam() {
+ return connectParam;
+ }
+
+ public String getRemotePath() {
+ return remotePath;
+ }
+
+ public long getChunkSize() {
+ return chunkSize;
+ }
+
+ public BulkFileType getFileType() {
+ return fileType;
+ }
+
+ public Map getConfig() {
+ return config;
+ }
+
+ @Override
+ public String toString() {
+ return "RemoteBulkWriterParam{" +
+ "collectionSchema=" + collectionSchema +
+ ", remotePath='" + remotePath + '\'' +
+ ", chunkSize=" + chunkSize +
+ ", fileType=" + fileType +
+ '}';
+ }
+
public static Builder newBuilder() {
return new Builder();
}
@@ -69,7 +97,7 @@ public static final class Builder {
private String remotePath;
private long chunkSize = 128 * 1024 * 1024;
private BulkFileType fileType = BulkFileType.PARQUET;
- private Map config = new HashMap<>();
+ private final Map config = new HashMap<>();
private Builder() {
}
@@ -80,7 +108,7 @@ private Builder() {
* @param collectionSchema collection info
* @return Builder
*/
- public Builder withCollectionSchema(@NonNull CollectionSchemaParam collectionSchema) {
+ public Builder withCollectionSchema(CollectionSchemaParam collectionSchema) {
this.collectionSchema = V2AdapterUtils.convertV1Schema(collectionSchema);
return this;
}
@@ -91,12 +119,12 @@ public Builder withCollectionSchema(@NonNull CollectionSchemaParam collectionSch
* @param collectionSchema collection schema
* @return Builder
*/
- public Builder withCollectionSchema(@NonNull CreateCollectionReq.CollectionSchema collectionSchema) {
+ public Builder withCollectionSchema(CreateCollectionReq.CollectionSchema collectionSchema) {
this.collectionSchema = collectionSchema;
return this;
}
- public Builder withConnectParam(@NotNull StorageConnectParam connectParam) {
+ public Builder withConnectParam(StorageConnectParam connectParam) {
this.connectParam = connectParam;
return this;
}
@@ -107,7 +135,7 @@ public Builder withConnectParam(@NotNull StorageConnectParam connectParam) {
* @param remotePath remote path
* @return Builder
*/
- public Builder withRemotePath(@NonNull String remotePath) {
+ public Builder withRemotePath(String remotePath) {
this.remotePath = remotePath;
return this;
}
@@ -117,7 +145,7 @@ public Builder withChunkSize(long chunkSize) {
return this;
}
- public Builder withFileType(@NonNull BulkFileType fileType) {
+ public Builder withFileType(BulkFileType fileType) {
this.fileType = fileType;
return this;
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageBulkWriter.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageBulkWriter.java
index 3917bdceb..ff4ee56d2 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageBulkWriter.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageBulkWriter.java
@@ -39,10 +39,10 @@
public class StageBulkWriter extends LocalBulkWriter {
private static final Logger logger = LoggerFactory.getLogger(StageBulkWriter.class);
- private String remotePath;
- private List> remoteFiles;
- private StageFileManager stageFileManager;
- private StageBulkWriterParam stageBulkWriterParam;
+ private final String remotePath;
+ private final List> remoteFiles;
+ private final StageFileManager stageFileManager;
+ private final StageBulkWriterParam stageBulkWriterParam;
public StageBulkWriter(StageBulkWriterParam bulkWriterParam) throws IOException {
super(bulkWriterParam.getCollectionSchema(),
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageBulkWriterParam.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageBulkWriterParam.java
index 8425fda56..84319d8ed 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageBulkWriterParam.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageBulkWriterParam.java
@@ -25,10 +25,6 @@
import io.milvus.param.ParamUtils;
import io.milvus.param.collection.CollectionSchemaParam;
import io.milvus.v2.service.collection.request.CreateCollectionReq;
-import lombok.Getter;
-import lombok.NonNull;
-import lombok.ToString;
-import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Map;
@@ -36,8 +32,6 @@
/**
* Parameters for stageBulkWriter interface.
*/
-@Getter
-@ToString
public class StageBulkWriterParam {
private final CreateCollectionReq.CollectionSchema collectionSchema;
private final String remotePath;
@@ -49,7 +43,7 @@ public class StageBulkWriterParam {
private final String apiKey;
private final String stageName;
- private StageBulkWriterParam(@NonNull Builder builder) {
+ private StageBulkWriterParam(Builder builder) {
this.collectionSchema = builder.collectionSchema;
this.remotePath = builder.remotePath;
this.chunkSize = builder.chunkSize;
@@ -61,6 +55,50 @@ private StageBulkWriterParam(@NonNull Builder builder) {
this.stageName = builder.stageName;
}
+ public CreateCollectionReq.CollectionSchema getCollectionSchema() {
+ return collectionSchema;
+ }
+
+ public String getRemotePath() {
+ return remotePath;
+ }
+
+ public long getChunkSize() {
+ return chunkSize;
+ }
+
+ public BulkFileType getFileType() {
+ return fileType;
+ }
+
+ public Map getConfig() {
+ return config;
+ }
+
+ public String getCloudEndpoint() {
+ return cloudEndpoint;
+ }
+
+ public String getApiKey() {
+ return apiKey;
+ }
+
+ public String getStageName() {
+ return stageName;
+ }
+
+ @Override
+ public String toString() {
+ return "StageBulkWriterParam{" +
+ "collectionSchema=" + collectionSchema +
+ ", remotePath='" + remotePath + '\'' +
+ ", chunkSize=" + chunkSize +
+ ", fileType=" + fileType +
+ ", cloudEndpoint='" + cloudEndpoint + '\'' +
+ ", stageName='" + stageName + '\'' +
+ '}';
+ }
+
public static Builder newBuilder() {
return new Builder();
}
@@ -73,7 +111,7 @@ public static final class Builder {
private String remotePath;
private long chunkSize = 128 * 1024 * 1024;
private BulkFileType fileType = BulkFileType.PARQUET;
- private Map config = new HashMap<>();
+ private final Map config = new HashMap<>();
private String cloudEndpoint;
private String apiKey;
@@ -89,7 +127,7 @@ private Builder() {
* @param collectionSchema collection info
* @return Builder
*/
- public Builder withCollectionSchema(@NonNull CollectionSchemaParam collectionSchema) {
+ public Builder withCollectionSchema(CollectionSchemaParam collectionSchema) {
this.collectionSchema = V2AdapterUtils.convertV1Schema(collectionSchema);
return this;
}
@@ -100,7 +138,7 @@ public Builder withCollectionSchema(@NonNull CollectionSchemaParam collectionSch
* @param collectionSchema collection schema
* @return Builder
*/
- public Builder withCollectionSchema(@NonNull CreateCollectionReq.CollectionSchema collectionSchema) {
+ public Builder withCollectionSchema(CreateCollectionReq.CollectionSchema collectionSchema) {
this.collectionSchema = collectionSchema;
return this;
}
@@ -111,7 +149,7 @@ public Builder withCollectionSchema(@NonNull CreateCollectionReq.CollectionSchem
* @param remotePath remote path
* @return Builder
*/
- public Builder withRemotePath(@NonNull String remotePath) {
+ public Builder withRemotePath(String remotePath) {
this.remotePath = remotePath;
return this;
}
@@ -121,7 +159,7 @@ public Builder withChunkSize(long chunkSize) {
return this;
}
- public Builder withFileType(@NonNull BulkFileType fileType) {
+ public Builder withFileType(BulkFileType fileType) {
this.fileType = fileType;
return this;
}
@@ -131,17 +169,17 @@ public Builder withConfig(String key, Object val) {
return this;
}
- public Builder withCloudEndpoint(@NotNull String cloudEndpoint) {
+ public Builder withCloudEndpoint(String cloudEndpoint) {
this.cloudEndpoint = cloudEndpoint;
return this;
}
- public Builder withApiKey(@NotNull String apiKey) {
+ public Builder withApiKey(String apiKey) {
this.apiKey = apiKey;
return this;
}
- public Builder withStageName(@NotNull String stageName) {
+ public Builder withStageName(String stageName) {
this.stageName = stageName;
return this;
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageFileManager.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageFileManager.java
index 4311e7fce..9aec466a9 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageFileManager.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageFileManager.java
@@ -42,12 +42,7 @@
import java.time.Instant;
import java.util.Date;
import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CompletionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
+import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
@@ -131,12 +126,12 @@ public CompletableFuture uploadFilesAsync(UploadFilesRequest
* tasks to complete within a timeout period. If tasks do not finish within
* the timeout, it will forcefully shut down the executor.
*
- *
+ *
* Usage recommendation:
*
* - Call this method when the StageFileManager is no longer needed.
*
- *
+ *
* Thread interruption is respected, and the interrupt status is restored if interrupted during shutdown.
*/
public void shutdownGracefully() {
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageFileManagerParam.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageFileManagerParam.java
index 8cb0b623e..c64b4873d 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageFileManagerParam.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageFileManagerParam.java
@@ -22,29 +22,48 @@
import io.milvus.bulkwriter.common.clientenum.ConnectType;
import io.milvus.exception.ParamException;
import io.milvus.param.ParamUtils;
-import lombok.Getter;
-import lombok.NonNull;
-import lombok.ToString;
-import org.jetbrains.annotations.NotNull;
/**
* Parameters for stageFileManager interface.
*/
-@Getter
-@ToString
public class StageFileManagerParam {
private final String cloudEndpoint;
private final String apiKey;
private final String stageName;
private final ConnectType connectType;
- private StageFileManagerParam(@NonNull Builder builder) {
+ private StageFileManagerParam(Builder builder) {
this.cloudEndpoint = builder.cloudEndpoint;
this.apiKey = builder.apiKey;
this.stageName = builder.stageName;
this.connectType = builder.connectType;
}
+ public String getCloudEndpoint() {
+ return cloudEndpoint;
+ }
+
+ public String getApiKey() {
+ return apiKey;
+ }
+
+ public String getStageName() {
+ return stageName;
+ }
+
+ public ConnectType getConnectType() {
+ return connectType;
+ }
+
+ @Override
+ public String toString() {
+ return "StageFileManagerParam{" +
+ "cloudEndpoint='" + cloudEndpoint + '\'' +
+ ", stageName='" + stageName + '\'' +
+ ", connectType=" + connectType +
+ '}';
+ }
+
public static Builder newBuilder() {
return new Builder();
}
@@ -69,17 +88,17 @@ private Builder() {
* For overseas regions, it is: https://api.cloud.zilliz.com
* For regions in China, it is: https://api.cloud.zilliz.com.cn
*/
- public Builder withCloudEndpoint(@NotNull String cloudEndpoint) {
+ public Builder withCloudEndpoint(String cloudEndpoint) {
this.cloudEndpoint = cloudEndpoint;
return this;
}
- public Builder withApiKey(@NotNull String apiKey) {
+ public Builder withApiKey(String apiKey) {
this.apiKey = apiKey;
return this;
}
- public Builder withStageName(@NotNull String stageName) {
+ public Builder withStageName(String stageName) {
this.stageName = stageName;
return this;
}
@@ -90,7 +109,7 @@ public Builder withStageName(@NotNull String stageName) {
* otherwise, the public endpoint will be used.
* You can also force the use of either the internal or public endpoint.
*/
- public Builder withConnectType(@NotNull ConnectType connectType) {
+ public Builder withConnectType(ConnectType connectType) {
this.connectType = connectType;
return this;
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageManagerParam.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageManagerParam.java
index 0145499d7..8dbb8e2f8 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageManagerParam.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/StageManagerParam.java
@@ -21,25 +21,34 @@
import io.milvus.exception.ParamException;
import io.milvus.param.ParamUtils;
-import lombok.Getter;
-import lombok.NonNull;
-import lombok.ToString;
-import org.jetbrains.annotations.NotNull;
/**
* Parameters for stageManager interface.
*/
-@Getter
-@ToString
public class StageManagerParam {
private final String cloudEndpoint;
private final String apiKey;
- private StageManagerParam(@NonNull Builder builder) {
+ private StageManagerParam(Builder builder) {
this.cloudEndpoint = builder.cloudEndpoint;
this.apiKey = builder.apiKey;
}
+ public String getCloudEndpoint() {
+ return cloudEndpoint;
+ }
+
+ public String getApiKey() {
+ return apiKey;
+ }
+
+ @Override
+ public String toString() {
+ return "StageManagerParam{" +
+ "cloudEndpoint='" + cloudEndpoint + '\'' +
+ '}';
+ }
+
public static Builder newBuilder() {
return new Builder();
}
@@ -60,12 +69,12 @@ private Builder() {
* For overseas regions, it is: https://api.cloud.zilliz.com
* For regions in China, it is: https://api.cloud.zilliz.com.cn
*/
- public Builder withCloudEndpoint(@NotNull String cloudEndpoint) {
+ public Builder withCloudEndpoint(String cloudEndpoint) {
this.cloudEndpoint = cloudEndpoint;
return this;
}
- public Builder withApiKey(@NotNull String apiKey) {
+ public Builder withApiKey(String apiKey) {
this.apiKey = apiKey;
return this;
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/clientenum/BulkFileType.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/clientenum/BulkFileType.java
index 728fb1871..86ed78cd1 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/clientenum/BulkFileType.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/clientenum/BulkFileType.java
@@ -19,20 +19,25 @@
package io.milvus.bulkwriter.common.clientenum;
-import lombok.Getter;
-
-@Getter
public enum BulkFileType {
PARQUET(1, ".parquet"),
JSON(2, ".json"),
CSV(3, ".csv"),
;
- private Integer code;
- private String suffix;
+ private final Integer code;
+ private final String suffix;
BulkFileType(Integer code, String suffix) {
this.code = code;
this.suffix = suffix;
}
+
+ public Integer getCode() {
+ return code;
+ }
+
+ public String getSuffix() {
+ return suffix;
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/clientenum/CloudStorage.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/clientenum/CloudStorage.java
index 2aba4216a..0a896cc5c 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/clientenum/CloudStorage.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/clientenum/CloudStorage.java
@@ -20,35 +20,32 @@
package io.milvus.bulkwriter.common.clientenum;
import io.milvus.exception.ParamException;
-import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.util.Lists;
import java.util.List;
public enum CloudStorage {
- MINIO("minio","%s", "minioAddress"),
- AWS("aws","s3.amazonaws.com", null),
- GCP("gcp" ,"storage.googleapis.com", null),
+ MINIO("minio", "%s", "minioAddress"),
+ AWS("aws", "s3.amazonaws.com", null),
+ GCP("gcp", "storage.googleapis.com", null),
- AZ("az" ,"%s.blob.core.windows.net", "accountName"),
- AZURE("azure" ,"%s.blob.core.windows.net", "accountName"),
+ AZ("az", "%s.blob.core.windows.net", "accountName"),
+ AZURE("azure", "%s.blob.core.windows.net", "accountName"),
- ALI("ali","oss-%s.aliyuncs.com", "region"),
- ALIYUN("aliyun","oss-%s.aliyuncs.com", "region"),
- ALIBABA("alibaba","oss-%s.aliyuncs.com", "region"),
- ALICLOU("alicloud","oss-%s.aliyuncs.com", "region"),
+ ALI("ali", "oss-%s.aliyuncs.com", "region"),
+ ALIYUN("aliyun", "oss-%s.aliyuncs.com", "region"),
+ ALIBABA("alibaba", "oss-%s.aliyuncs.com", "region"),
+ ALICLOU("alicloud", "oss-%s.aliyuncs.com", "region"),
- TC("tc","cos.%s.myqcloud.com", "region"),
- TENCENT("tencent","cos.%s.myqcloud.com", "region")
- ;
+ TC("tc", "cos.%s.myqcloud.com", "region"),
+ TENCENT("tencent", "cos.%s.myqcloud.com", "region");
- @Getter
- private String cloudName;
+ private final String cloudName;
- private String endpoint;
+ private final String endpoint;
- private String replace;
+ private final String replace;
CloudStorage(String cloudName, String endpoint, String replace) {
this.cloudName = cloudName;
@@ -56,6 +53,10 @@ public enum CloudStorage {
this.replace = replace;
}
+ public String getCloudName() {
+ return cloudName;
+ }
+
public static boolean isAliCloud(String cloudName) {
List aliCloudStorages = Lists.newArrayList(
CloudStorage.ALI, CloudStorage.ALIYUN, CloudStorage.ALIBABA, CloudStorage.ALICLOU
@@ -87,7 +88,7 @@ public static CloudStorage getCloudStorage(String cloudName) {
}
public String getEndpoint(String... replaceParams) {
- if (StringUtils.isEmpty(replace)) {
+ if (StringUtils.isEmpty(replace)) {
return endpoint;
}
if (replaceParams.length == 0) {
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/utils/GeneratorUtils.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/utils/GeneratorUtils.java
index dccb3ce1b..0b18d72bd 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/utils/GeneratorUtils.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/utils/GeneratorUtils.java
@@ -72,7 +72,7 @@ public static List generatorInt32Value(int count) {
public static List generatorFloatValue(int count) {
List result = new ArrayList<>();
for (int i = 0; i < count; ++i) {
- result.add( (float)i / 3);
+ result.add((float) i / 3);
}
return result;
}
@@ -80,7 +80,7 @@ public static List generatorFloatValue(int count) {
public static List generatorDoubleValue(int count) {
List result = new ArrayList<>();
for (int i = 0; i < count; ++i) {
- result.add((double)i / 7);
+ result.add((double) i / 7);
}
return result;
}
@@ -135,7 +135,7 @@ public static List> generatorFloatVector(int dim, int count) {
for (int i = 0; i < count; ++i) {
List result = new ArrayList<>();
for (int j = 0; j < dim; ++j) {
- result.add( (float)j / 3);
+ result.add((float) j / 3);
}
floatVector.add(result);
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/utils/ParquetUtils.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/utils/ParquetUtils.java
index f444b4e0a..025b3d8b4 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/utils/ParquetUtils.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/utils/ParquetUtils.java
@@ -19,12 +19,12 @@
package io.milvus.bulkwriter.common.utils;
+import io.milvus.v2.service.collection.request.CreateCollectionReq;
import org.apache.hadoop.conf.Configuration;
import org.apache.parquet.schema.LogicalTypeAnnotation;
import org.apache.parquet.schema.MessageType;
import org.apache.parquet.schema.PrimitiveType;
import org.apache.parquet.schema.Types;
-import io.milvus.v2.service.collection.request.CreateCollectionReq;
import java.util.List;
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/utils/V2AdapterUtils.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/utils/V2AdapterUtils.java
index 6f7b0ed6c..a20ef6cf0 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/utils/V2AdapterUtils.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/common/utils/V2AdapterUtils.java
@@ -19,7 +19,6 @@
package io.milvus.bulkwriter.common.utils;
-import io.milvus.grpc.DataType;
import io.milvus.param.collection.CollectionSchemaParam;
import io.milvus.param.collection.FieldType;
import io.milvus.v2.service.collection.request.CreateCollectionReq;
@@ -66,7 +65,7 @@ public class V2AdapterUtils {
// }
private static CreateCollectionReq.FieldSchema convertV1Field(FieldType fieldType) {
- Integer maxLength = fieldType.getMaxLength() > 0 ? fieldType.getMaxLength():65535;
+ Integer maxLength = fieldType.getMaxLength() > 0 ? fieldType.getMaxLength() : 65535;
Integer dimension = fieldType.getDimension() > 0 ? fieldType.getDimension() : null;
Integer maxCapacity = fieldType.getMaxCapacity() > 0 ? fieldType.getMaxCapacity() : null;
io.milvus.v2.common.DataType elementType = fieldType.getElementType() == null ? null : io.milvus.v2.common.DataType.valueOf(fieldType.getElementType().name());
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/connect/AzureConnectParam.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/connect/AzureConnectParam.java
index 8546457cb..5716d6f52 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/connect/AzureConnectParam.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/connect/AzureConnectParam.java
@@ -22,28 +22,49 @@
import com.azure.core.credential.TokenCredential;
import io.milvus.exception.ParamException;
import io.milvus.param.ParamUtils;
-import lombok.Getter;
-import lombok.NonNull;
-import lombok.ToString;
+import org.jetbrains.annotations.NotNull;
/**
* Parameters for RemoteBulkWriter interface.
*/
-@Getter
-@ToString
public class AzureConnectParam extends StorageConnectParam {
private final String containerName;
private final String connStr;
private final String accountUrl;
private final TokenCredential credential;
- private AzureConnectParam(@NonNull Builder builder) {
+ private AzureConnectParam(Builder builder) {
this.containerName = builder.containerName;
this.connStr = builder.connStr;
this.accountUrl = builder.accountUrl;
this.credential = builder.credential;
}
+ public String getContainerName() {
+ return containerName;
+ }
+
+ public String getConnStr() {
+ return connStr;
+ }
+
+ public String getAccountUrl() {
+ return accountUrl;
+ }
+
+ public TokenCredential getCredential() {
+ return credential;
+ }
+
+ @Override
+ public String toString() {
+ return "AzureConnectParam{" +
+ "containerName='" + containerName + '\'' +
+ ", connStr='" + connStr + '\'' +
+ ", accountUrl='" + accountUrl + '\'' +
+ '}';
+ }
+
public static Builder newBuilder() {
return new Builder();
}
@@ -64,7 +85,7 @@ private Builder() {
* @param containerName The target container name
* @return Builder
*/
- public Builder withContainerName(@NonNull String containerName) {
+ public Builder withContainerName(@NotNull String containerName) {
this.containerName = containerName;
return this;
}
@@ -76,18 +97,18 @@ public Builder withContainerName(@NonNull String containerName) {
* ...
* @return Builder
*/
- public Builder withConnStr(@NonNull String connStr) {
+ public Builder withConnStr(@NotNull String connStr) {
this.connStr = connStr;
return this;
}
/**
* @param accountUrl A string in format like "https://[storage-account].blob.core.windows.net"
- * Read this link for more info:
- * ...
+ * Read this link for more info:
+ * ...
* @return Builder
*/
- public Builder withAccountUrl(@NonNull String accountUrl) {
+ public Builder withAccountUrl(@NotNull String accountUrl) {
this.accountUrl = accountUrl;
return this;
}
@@ -95,10 +116,10 @@ public Builder withAccountUrl(@NonNull String accountUrl) {
/**
*
* @param credential Account access key for the account, read this link for more info:
- * ...
+ * ...
* @return Builder
*/
- public Builder withCredential(@NonNull TokenCredential credential) {
+ public Builder withCredential(@NotNull TokenCredential credential) {
this.credential = credential;
return this;
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/connect/S3ConnectParam.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/connect/S3ConnectParam.java
index e39d84a39..afb764935 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/connect/S3ConnectParam.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/connect/S3ConnectParam.java
@@ -21,17 +21,12 @@
import io.milvus.exception.ParamException;
import io.milvus.param.ParamUtils;
-import lombok.Getter;
-import lombok.NonNull;
-import lombok.ToString;
import okhttp3.OkHttpClient;
import org.jetbrains.annotations.NotNull;
/**
* Parameters for RemoteBulkWriter interface.
*/
-@Getter
-@ToString
public class S3ConnectParam extends StorageConnectParam {
private final String bucketName;
private final String endpoint;
@@ -42,7 +37,7 @@ public class S3ConnectParam extends StorageConnectParam {
private final OkHttpClient httpClient;
private final String cloudName;
- private S3ConnectParam(@NonNull Builder builder) {
+ private S3ConnectParam(@NotNull Builder builder) {
this.bucketName = builder.bucketName;
this.endpoint = builder.endpoint;
this.accessKey = builder.accessKey;
@@ -53,6 +48,51 @@ private S3ConnectParam(@NonNull Builder builder) {
this.cloudName = builder.cloudName;
}
+ public String getBucketName() {
+ return bucketName;
+ }
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public String getAccessKey() {
+ return accessKey;
+ }
+
+ public String getSecretKey() {
+ return secretKey;
+ }
+
+ public String getSessionToken() {
+ return sessionToken;
+ }
+
+ public String getRegion() {
+ return region;
+ }
+
+ public OkHttpClient getHttpClient() {
+ return httpClient;
+ }
+
+ public String getCloudName() {
+ return cloudName;
+ }
+
+ @Override
+ public String toString() {
+ return "S3ConnectParam{" +
+ "bucketName='" + bucketName + '\'' +
+ ", endpoint='" + endpoint + '\'' +
+ ", accessKey='" + accessKey + '\'' +
+ ", secretKey='" + secretKey + '\'' +
+ ", sessionToken='" + sessionToken + '\'' +
+ ", region='" + region + '\'' +
+ ", cloudName='" + cloudName + '\'' +
+ '}';
+ }
+
public static Builder newBuilder() {
return new Builder();
}
@@ -90,7 +130,7 @@ public Builder withCloudName(@NotNull String cloudName) {
* @param bucketName bucket info
* @return Builder
*/
- public Builder withBucketName(@NonNull String bucketName) {
+ public Builder withBucketName(@NotNull String bucketName) {
this.bucketName = bucketName;
return this;
}
@@ -101,32 +141,32 @@ public Builder withBucketName(@NonNull String bucketName) {
* @param endpoint endpoint info
* @return Builder
*/
- public Builder withEndpoint(@NonNull String endpoint) {
+ public Builder withEndpoint(@NotNull String endpoint) {
this.endpoint = endpoint;
return this;
}
- public Builder withAccessKey(@NonNull String accessKey) {
+ public Builder withAccessKey(@NotNull String accessKey) {
this.accessKey = accessKey;
return this;
}
- public Builder withSecretKey(@NonNull String secretKey) {
+ public Builder withSecretKey(@NotNull String secretKey) {
this.secretKey = secretKey;
return this;
}
- public Builder withSessionToken(@NonNull String sessionToken) {
+ public Builder withSessionToken(@NotNull String sessionToken) {
this.sessionToken = sessionToken;
return this;
}
- public Builder withRegion(@NonNull String region) {
+ public Builder withRegion(@NotNull String region) {
this.region = region;
return this;
}
- public Builder withHttpClient(@NonNull OkHttpClient httpClient) {
+ public Builder withHttpClient(@NotNull OkHttpClient httpClient) {
this.httpClient = httpClient;
return this;
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/model/CompleteMultipartUploadOutputModel.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/model/CompleteMultipartUploadOutputModel.java
index 654f3c8eb..9f1a4f2bc 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/model/CompleteMultipartUploadOutputModel.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/model/CompleteMultipartUploadOutputModel.java
@@ -19,7 +19,8 @@ public class CompleteMultipartUploadOutputModel {
@Element(name = "ETag")
private String etag;
- public CompleteMultipartUploadOutputModel() {}
+ public CompleteMultipartUploadOutputModel() {
+ }
public String location() {
return location;
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/model/UploadFilesResult.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/model/UploadFilesResult.java
index 43fe1de0f..f13ec9587 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/model/UploadFilesResult.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/model/UploadFilesResult.java
@@ -1,15 +1,71 @@
package io.milvus.bulkwriter.model;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
public class UploadFilesResult {
private String stageName;
private String path;
+
+ public UploadFilesResult() {
+ }
+
+ public UploadFilesResult(String stageName, String path) {
+ this.stageName = stageName;
+ this.path = path;
+ }
+
+ private UploadFilesResult(UploadFilesResultBuilder builder) {
+ this.stageName = builder.stageName;
+ this.path = builder.path;
+ }
+
+ public String getStageName() {
+ return stageName;
+ }
+
+ public void setStageName(String stageName) {
+ this.stageName = stageName;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ @Override
+ public String toString() {
+ return "UploadFilesResult{" +
+ "stageName='" + stageName + '\'' +
+ ", path='" + path + '\'' +
+ '}';
+ }
+
+ public static UploadFilesResultBuilder builder() {
+ return new UploadFilesResultBuilder();
+ }
+
+ public static class UploadFilesResultBuilder {
+ private String stageName;
+ private String path;
+
+ private UploadFilesResultBuilder() {
+ this.stageName = "";
+ this.path = "";
+ }
+
+ public UploadFilesResultBuilder stageName(String stageName) {
+ this.stageName = stageName;
+ return this;
+ }
+
+ public UploadFilesResultBuilder path(String path) {
+ this.path = path;
+ return this;
+ }
+
+ public UploadFilesResult build() {
+ return new UploadFilesResult(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/describe/BaseDescribeImportRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/describe/BaseDescribeImportRequest.java
index 9fae25d6c..ee98abe80 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/describe/BaseDescribeImportRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/describe/BaseDescribeImportRequest.java
@@ -19,22 +19,61 @@
package io.milvus.bulkwriter.request.describe;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
import java.io.Serializable;
-@Data
-@SuperBuilder(toBuilder = true)
-@AllArgsConstructor
-@NoArgsConstructor
public class BaseDescribeImportRequest implements Serializable {
private static final long serialVersionUID = -787626534606813089L;
+
/**
* If you are calling the cloud API, this parameter should be set to your API_KEY.
* If you are using Milvus directly, this parameter should be set to your userName:password.
*/
private String apiKey;
+
+ public BaseDescribeImportRequest() {
+ }
+
+ public BaseDescribeImportRequest(String apiKey) {
+ this.apiKey = apiKey;
+ }
+
+ protected BaseDescribeImportRequest(BaseDescribeImportRequestBuilder> builder) {
+ this.apiKey = builder.apiKey;
+ }
+
+ public String getApiKey() {
+ return apiKey;
+ }
+
+ public void setApiKey(String apiKey) {
+ this.apiKey = apiKey;
+ }
+
+ @Override
+ public String toString() {
+ return "BaseDescribeImportRequest{" +
+ "apiKey='" + apiKey + '\'' +
+ '}';
+ }
+
+ public static BaseDescribeImportRequestBuilder> builder() {
+ return new BaseDescribeImportRequestBuilder<>();
+ }
+
+ public static class BaseDescribeImportRequestBuilder> {
+ private String apiKey = "";
+
+ protected BaseDescribeImportRequestBuilder() {
+ this.apiKey = "";
+ }
+
+ public T apiKey(String apiKey) {
+ this.apiKey = apiKey;
+ return (T) this;
+ }
+
+ public BaseDescribeImportRequest build() {
+ return new BaseDescribeImportRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/describe/CloudDescribeImportRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/describe/CloudDescribeImportRequest.java
index ea15a95de..e3f49228b 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/describe/CloudDescribeImportRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/describe/CloudDescribeImportRequest.java
@@ -19,17 +19,74 @@
package io.milvus.bulkwriter.request.describe;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-@Data
-@SuperBuilder
-@AllArgsConstructor
-@NoArgsConstructor
public class CloudDescribeImportRequest extends BaseDescribeImportRequest {
private static final long serialVersionUID = -6479634844757426430L;
private String clusterId;
private String jobId;
+
+ public CloudDescribeImportRequest() {
+ }
+
+ public CloudDescribeImportRequest(String clusterId, String jobId) {
+ this.clusterId = clusterId;
+ this.jobId = jobId;
+ }
+
+ protected CloudDescribeImportRequest(CloudDescribeImportRequestBuilder builder) {
+ super(builder);
+ this.clusterId = builder.clusterId;
+ this.jobId = builder.jobId;
+ }
+
+ public String getClusterId() {
+ return clusterId;
+ }
+
+ public void setClusterId(String clusterId) {
+ this.clusterId = clusterId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ @Override
+ public String toString() {
+ return "CloudDescribeImportRequest{" +
+ "clusterId='" + clusterId + '\'' +
+ ", jobId='" + jobId + '\'' +
+ '}';
+ }
+
+ public static CloudDescribeImportRequestBuilder builder() {
+ return new CloudDescribeImportRequestBuilder();
+ }
+
+ public static class CloudDescribeImportRequestBuilder extends BaseDescribeImportRequestBuilder {
+ private String clusterId;
+ private String jobId;
+
+ private CloudDescribeImportRequestBuilder() {
+ this.clusterId = "";
+ this.jobId = "";
+ }
+
+ public CloudDescribeImportRequestBuilder clusterId(String clusterId) {
+ this.clusterId = clusterId;
+ return this;
+ }
+
+ public CloudDescribeImportRequestBuilder jobId(String jobId) {
+ this.jobId = jobId;
+ return this;
+ }
+
+ public CloudDescribeImportRequest build() {
+ return new CloudDescribeImportRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/describe/MilvusDescribeImportRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/describe/MilvusDescribeImportRequest.java
index 2cfa6059e..3f8a2e1ac 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/describe/MilvusDescribeImportRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/describe/MilvusDescribeImportRequest.java
@@ -19,16 +19,55 @@
package io.milvus.bulkwriter.request.describe;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-@Data
-@SuperBuilder
-@AllArgsConstructor
-@NoArgsConstructor
public class MilvusDescribeImportRequest extends BaseDescribeImportRequest {
private static final long serialVersionUID = 6123645882882199210L;
private String jobId;
+
+ public MilvusDescribeImportRequest() {
+ }
+
+ public MilvusDescribeImportRequest(String jobId) {
+ this.jobId = jobId;
+ }
+
+ protected MilvusDescribeImportRequest(MilvusDescribeImportRequestBuilder builder) {
+ super(builder);
+ this.jobId = builder.jobId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ @Override
+ public String toString() {
+ return "MilvusDescribeImportRequest{" +
+ ", jobId='" + jobId + '\'' +
+ '}';
+ }
+
+ public static MilvusDescribeImportRequestBuilder builder() {
+ return new MilvusDescribeImportRequestBuilder();
+ }
+
+ public static class MilvusDescribeImportRequestBuilder extends BaseDescribeImportRequestBuilder {
+ private String jobId;
+
+ private MilvusDescribeImportRequestBuilder() {
+ this.jobId = "";
+ }
+
+ public MilvusDescribeImportRequestBuilder jobId(String jobId) {
+ this.jobId = jobId;
+ return this;
+ }
+
+ public MilvusDescribeImportRequest build() {
+ return new MilvusDescribeImportRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/BaseImportRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/BaseImportRequest.java
index 99fd7e194..fc745e9b4 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/BaseImportRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/BaseImportRequest.java
@@ -19,18 +19,10 @@
package io.milvus.bulkwriter.request.import_;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
import java.io.Serializable;
+import java.util.HashMap;
import java.util.Map;
-@Data
-@SuperBuilder(toBuilder = true)
-@AllArgsConstructor
-@NoArgsConstructor
public class BaseImportRequest implements Serializable {
private static final long serialVersionUID = 8192049841043084620L;
/**
@@ -40,4 +32,69 @@ public class BaseImportRequest implements Serializable {
private String apiKey;
private Map options;
+
+ public BaseImportRequest() {
+ }
+
+ public BaseImportRequest(String apiKey, Map options) {
+ this.apiKey = apiKey;
+ this.options = options;
+ }
+
+ protected BaseImportRequest(BaseImportRequestBuilder> builder) {
+ this.apiKey = builder.apiKey;
+ this.options = builder.options;
+ }
+
+ public String getApiKey() {
+ return apiKey;
+ }
+
+ public void setApiKey(String apiKey) {
+ this.apiKey = apiKey;
+ }
+
+ public Map getOptions() {
+ return options;
+ }
+
+ public void setOptions(Map options) {
+ this.options = options;
+ }
+
+ @Override
+ public String toString() {
+ return "BaseImportRequest{" +
+ "apiKey='" + apiKey + '\'' +
+ "options=" + options +
+ '}';
+ }
+
+ public static BaseImportRequestBuilder> builder() {
+ return new BaseImportRequestBuilder<>();
+ }
+
+ public static class BaseImportRequestBuilder> {
+ private String apiKey = "";
+ private Map options;
+
+ protected BaseImportRequestBuilder() {
+ this.apiKey = "";
+ this.options = new HashMap<>();
+ }
+
+ public T apiKey(String apiKey) {
+ this.apiKey = apiKey;
+ return (T) this;
+ }
+
+ public T options(Map options) {
+ this.options = options;
+ return (T) this;
+ }
+
+ public BaseImportRequest build() {
+ return new BaseImportRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/CloudImportRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/CloudImportRequest.java
index 0fd2819d6..0574a0e55 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/CloudImportRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/CloudImportRequest.java
@@ -19,17 +19,9 @@
package io.milvus.bulkwriter.request.import_;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
+import java.util.ArrayList;
import java.util.List;
-@Data
-@SuperBuilder
-@AllArgsConstructor
-@NoArgsConstructor
/*
If you want to import data into a Zilliz cloud instance and your data is stored in a storage bucket,
you can use this method to import the data from the bucket.
@@ -47,10 +39,10 @@ public class CloudImportRequest extends BaseImportRequest {
/**
* If the collection has partitionKey enabled:
- * - The partitionName parameter cannot be specified for import.
+ * - The partitionName parameter cannot be specified for import.
* If the collection does not have partitionKey enabled:
- * - You may specify partitionName for the import.
- * - Defaults to the "default" partition if not specified.
+ * - You may specify partitionName for the import.
+ * - Defaults to the "default" partition if not specified.
*/
private String partitionName;
@@ -58,21 +50,21 @@ public class CloudImportRequest extends BaseImportRequest {
* Data import can be configured in multiple ways using `objectUrls`:
*
* 1. Multi-path import (multiple folders or files):
- * "objectUrls": [
- * ["s3://bucket-name/parquet-folder-1/1.parquet"],
- * ["s3://bucket-name/parquet-folder-2/1.parquet"],
- * ["s3://bucket-name/parquet-folder-3/"]
- * ]
+ * "objectUrls": [
+ * ["s3://bucket-name/parquet-folder-1/1.parquet"],
+ * ["s3://bucket-name/parquet-folder-2/1.parquet"],
+ * ["s3://bucket-name/parquet-folder-3/"]
+ * ]
*
* 2. Folder import:
- * "objectUrls": [
- * ["s3://bucket-name/parquet-folder/"]
- * ]
+ * "objectUrls": [
+ * ["s3://bucket-name/parquet-folder/"]
+ * ]
*
* 3. Single file import:
- * "objectUrls": [
- * ["s3://bucket-name/parquet-folder/1.parquet"]
- * ]
+ * "objectUrls": [
+ * ["s3://bucket-name/parquet-folder/1.parquet"]
+ * ]
*/
private List> objectUrls;
@@ -80,20 +72,218 @@ public class CloudImportRequest extends BaseImportRequest {
* Use `objectUrls` instead for more flexible multi-path configuration.
*
* Folder import:
- * "objectUrl": "s3://bucket-name/parquet-folder/"
+ * "objectUrl": "s3://bucket-name/parquet-folder/"
*
* File import:
- * "objectUrl": "s3://bucket-name/parquet-folder/1.parquet"
+ * "objectUrl": "s3://bucket-name/parquet-folder/1.parquet"
*/
@Deprecated
private String objectUrl;
- /** Specify `accessKey` and `secretKey`; for short-term credentials, also include `token`. */
+ /**
+ * Specify `accessKey` and `secretKey`; for short-term credentials, also include `token`.
+ */
private String accessKey;
- /** Specify `accessKey` and `secretKey`; for short-term credentials, also include `token`. */
+ /**
+ * Specify `accessKey` and `secretKey`; for short-term credentials, also include `token`.
+ */
private String secretKey;
- /** Specify `accessKey` and `secretKey`; for short-term credentials, also include `token`. */
+ /**
+ * Specify `accessKey` and `secretKey`; for short-term credentials, also include `token`.
+ */
private String token;
+
+ public CloudImportRequest() {
+ }
+
+ public CloudImportRequest(String clusterId, String dbName, String collectionName, String partitionName,
+ List> objectUrls, String accessKey, String secretKey, String token) {
+ this.clusterId = clusterId;
+ this.dbName = dbName;
+ this.collectionName = collectionName;
+ this.partitionName = partitionName;
+ this.objectUrls = objectUrls;
+ this.accessKey = accessKey;
+ this.secretKey = secretKey;
+ this.token = token;
+ }
+
+ protected CloudImportRequest(CloudImportRequestBuilder builder) {
+ super(builder);
+ this.clusterId = builder.clusterId;
+ this.dbName = builder.dbName;
+ this.collectionName = builder.collectionName;
+ this.partitionName = builder.partitionName;
+ this.objectUrls = builder.objectUrls;
+ this.objectUrl = builder.objectUrl;
+ this.accessKey = builder.accessKey;
+ this.secretKey = builder.secretKey;
+ this.token = builder.token;
+ }
+
+ public String getClusterId() {
+ return clusterId;
+ }
+
+ public void setClusterId(String clusterId) {
+ this.clusterId = clusterId;
+ }
+
+ public String getDbName() {
+ return dbName;
+ }
+
+ public void setDbName(String dbName) {
+ this.dbName = dbName;
+ }
+
+ public String getCollectionName() {
+ return collectionName;
+ }
+
+ public void setCollectionName(String collectionName) {
+ this.collectionName = collectionName;
+ }
+
+ public String getPartitionName() {
+ return partitionName;
+ }
+
+ public void setPartitionName(String partitionName) {
+ this.partitionName = partitionName;
+ }
+
+ public List> getObjectUrls() {
+ return objectUrls;
+ }
+
+ public void setObjectUrls(List> objectUrls) {
+ this.objectUrls = objectUrls;
+ }
+
+ public String getObjectUrl() {
+ return objectUrl;
+ }
+
+ public void setObjectUrl(String objectUrl) {
+ this.objectUrl = objectUrl;
+ }
+
+ public String getAccessKey() {
+ return accessKey;
+ }
+
+ public void setAccessKey(String accessKey) {
+ this.accessKey = accessKey;
+ }
+
+ public String getSecretKey() {
+ return secretKey;
+ }
+
+ public void setSecretKey(String secretKey) {
+ this.secretKey = secretKey;
+ }
+
+ public String getToken() {
+ return token;
+ }
+
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+ @Override
+ public String toString() {
+ return "CloudImportRequest{" +
+ "clusterId='" + clusterId + '\'' +
+ ", dbName='" + dbName + '\'' +
+ ", collectionName='" + collectionName + '\'' +
+ ", partitionName='" + partitionName + '\'' +
+ ", objectUrls=" + objectUrls +
+ ", objectUrl='" + objectUrl + '\'' +
+ ", accessKey='" + accessKey + '\'' +
+ ", secretKey='" + secretKey + '\'' +
+ ", token='" + token + '\'' +
+ '}';
+ }
+
+ public static CloudImportRequestBuilder builder() {
+ return new CloudImportRequestBuilder();
+ }
+
+ public static class CloudImportRequestBuilder extends BaseImportRequestBuilder {
+ private String clusterId;
+ private String dbName;
+ private String collectionName;
+ private String partitionName;
+ private List> objectUrls;
+ private String objectUrl;
+ private String accessKey;
+ private String secretKey;
+ private String token;
+
+ private CloudImportRequestBuilder() {
+ this.clusterId = "";
+ this.dbName = "";
+ this.collectionName = "";
+ this.partitionName = "";
+ this.objectUrls = new ArrayList<>();
+ this.objectUrl = "";
+ this.accessKey = "";
+ this.secretKey = "";
+ this.token = "";
+ }
+
+ public CloudImportRequestBuilder clusterId(String clusterId) {
+ this.clusterId = clusterId;
+ return this;
+ }
+
+ public CloudImportRequestBuilder dbName(String dbName) {
+ this.dbName = dbName;
+ return this;
+ }
+
+ public CloudImportRequestBuilder collectionName(String collectionName) {
+ this.collectionName = collectionName;
+ return this;
+ }
+
+ public CloudImportRequestBuilder partitionName(String partitionName) {
+ this.partitionName = partitionName;
+ return this;
+ }
+
+ public CloudImportRequestBuilder objectUrls(List> objectUrls) {
+ this.objectUrls = objectUrls;
+ return this;
+ }
+
+ public CloudImportRequestBuilder objectUrl(String objectUrl) {
+ this.objectUrl = objectUrl;
+ return this;
+ }
+
+ public CloudImportRequestBuilder accessKey(String accessKey) {
+ this.accessKey = accessKey;
+ return this;
+ }
+
+ public CloudImportRequestBuilder secretKey(String secretKey) {
+ this.secretKey = secretKey;
+ return this;
+ }
+
+ public CloudImportRequestBuilder token(String token) {
+ this.token = token;
+ return this;
+ }
+
+ public CloudImportRequest build() {
+ return new CloudImportRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/MilvusImportRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/MilvusImportRequest.java
index 7149fbfe5..0cc5ae95a 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/MilvusImportRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/MilvusImportRequest.java
@@ -19,17 +19,9 @@
package io.milvus.bulkwriter.request.import_;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
+import java.util.ArrayList;
import java.util.List;
-@Data
-@SuperBuilder
-@AllArgsConstructor
-@NoArgsConstructor
/*
If you want to import data into open-source Milvus,
you can use this method to import the data files stored in the bucket where Milvus resides.
@@ -45,10 +37,10 @@ public class MilvusImportRequest extends BaseImportRequest {
/**
* If the collection has partitionKey enabled:
- * - The partitionName parameter cannot be specified for import.
+ * - The partitionName parameter cannot be specified for import.
* If the collection does not have partitionKey enabled:
- * - You may specify partitionName for the import.
- * - Defaults to the "default" partition if not specified.
+ * - You may specify partitionName for the import.
+ * - Defaults to the "default" partition if not specified.
*/
private String partitionName;
@@ -56,16 +48,118 @@ public class MilvusImportRequest extends BaseImportRequest {
* Data import can be configured in multiple ways using `files`:
*
* 1. Multi-path import (multiple files):
- * "files": [
- * ["parquet-folder-1/1.parquet"],
- * ["parquet-folder-2/1.parquet"],
- * ["parquet-folder-3/1.parquet"]
- * ]
+ * "files": [
+ * ["parquet-folder-1/1.parquet"],
+ * ["parquet-folder-2/1.parquet"],
+ * ["parquet-folder-3/1.parquet"]
+ * ]
*
* 2. Single file import:
- * "files": [
- * ["parquet-folder/1.parquet"]
- * ]
+ * "files": [
+ * ["parquet-folder/1.parquet"]
+ * ]
*/
private List> files;
+
+ public MilvusImportRequest() {
+ }
+
+ public MilvusImportRequest(String dbName, String collectionName, String partitionName, List> files) {
+ this.dbName = dbName;
+ this.collectionName = collectionName;
+ this.partitionName = partitionName;
+ this.files = files;
+ }
+
+ protected MilvusImportRequest(MilvusImportRequestBuilder builder) {
+ super(builder);
+ this.dbName = builder.dbName;
+ this.collectionName = builder.collectionName;
+ this.partitionName = builder.partitionName;
+ this.files = builder.files;
+ }
+
+ public String getDbName() {
+ return dbName;
+ }
+
+ public void setDbName(String dbName) {
+ this.dbName = dbName;
+ }
+
+ public String getCollectionName() {
+ return collectionName;
+ }
+
+ public void setCollectionName(String collectionName) {
+ this.collectionName = collectionName;
+ }
+
+ public String getPartitionName() {
+ return partitionName;
+ }
+
+ public void setPartitionName(String partitionName) {
+ this.partitionName = partitionName;
+ }
+
+ public List> getFiles() {
+ return files;
+ }
+
+ public void setFiles(List> files) {
+ this.files = files;
+ }
+
+ @Override
+ public String toString() {
+ return "MilvusImportRequest{" +
+ "dbName='" + dbName + '\'' +
+ ", collectionName='" + collectionName + '\'' +
+ ", partitionName='" + partitionName + '\'' +
+ ", files=" + files +
+ '}';
+ }
+
+ public static MilvusImportRequestBuilder builder() {
+ return new MilvusImportRequestBuilder();
+ }
+
+ public static class MilvusImportRequestBuilder extends BaseImportRequestBuilder {
+ private String dbName;
+ private String collectionName;
+ private String partitionName;
+ private List> files;
+
+ private MilvusImportRequestBuilder() {
+ this.dbName = "";
+ this.collectionName = "";
+ this.partitionName = "";
+ this.files = new ArrayList<>();
+ }
+
+ public MilvusImportRequestBuilder dbName(String dbName) {
+ this.dbName = dbName;
+ return this;
+ }
+
+ public MilvusImportRequestBuilder collectionName(String collectionName) {
+ this.collectionName = collectionName;
+ return this;
+ }
+
+ public MilvusImportRequestBuilder partitionName(String partitionName) {
+ this.partitionName = partitionName;
+ return this;
+ }
+
+ public MilvusImportRequestBuilder files(List> files) {
+ this.files = files;
+ return this;
+ }
+
+ public MilvusImportRequest build() {
+ return new MilvusImportRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/StageImportRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/StageImportRequest.java
index 6a2215f52..e192bc3d7 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/StageImportRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/import_/StageImportRequest.java
@@ -19,17 +19,9 @@
package io.milvus.bulkwriter.request.import_;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
+import java.util.ArrayList;
import java.util.List;
-@Data
-@SuperBuilder
-@AllArgsConstructor
-@NoArgsConstructor
/*
If you want to import data into a Zilliz cloud instance and your data is stored in a Zilliz stage,
you can use this method to import the data from the stage.
@@ -46,10 +38,10 @@ public class StageImportRequest extends BaseImportRequest {
/**
* If the collection has partitionKey enabled:
- * - The partitionName parameter cannot be specified for import.
+ * - The partitionName parameter cannot be specified for import.
* If the collection does not have partitionKey enabled:
- * - You may specify partitionName for the import.
- * - Defaults to the "default" partition if not specified.
+ * - You may specify partitionName for the import.
+ * - Defaults to the "default" partition if not specified.
*/
private String partitionName;
@@ -59,21 +51,160 @@ public class StageImportRequest extends BaseImportRequest {
* Data import can be configured in multiple ways using `dataPaths`:
*
* 1. Multi-path import (multiple folders or files):
- * "dataPaths": [
- * ["parquet-folder-1/1.parquet"],
- * ["parquet-folder-2/1.parquet"],
- * ["parquet-folder-3/"]
- * ]
+ * "dataPaths": [
+ * ["parquet-folder-1/1.parquet"],
+ * ["parquet-folder-2/1.parquet"],
+ * ["parquet-folder-3/"]
+ * ]
*
* 2. Folder import:
- * "dataPaths": [
- * ["parquet-folder/"]
- * ]
+ * "dataPaths": [
+ * ["parquet-folder/"]
+ * ]
*
* 3. Single file import:
- * "dataPaths": [
- * ["parquet-folder/1.parquet"]
- * ]
+ * "dataPaths": [
+ * ["parquet-folder/1.parquet"]
+ * ]
*/
private List> dataPaths;
+
+ public StageImportRequest() {
+ }
+
+ public StageImportRequest(String clusterId, String dbName, String collectionName, String partitionName,
+ String stageName, List> dataPaths) {
+ this.clusterId = clusterId;
+ this.dbName = dbName;
+ this.collectionName = collectionName;
+ this.partitionName = partitionName;
+ this.stageName = stageName;
+ this.dataPaths = dataPaths;
+ }
+
+ protected StageImportRequest(StageImportRequestBuilder builder) {
+ super(builder);
+ this.clusterId = builder.clusterId;
+ this.dbName = builder.dbName;
+ this.collectionName = builder.collectionName;
+ this.partitionName = builder.partitionName;
+ this.stageName = builder.stageName;
+ this.dataPaths = builder.dataPaths;
+ }
+
+ public String getClusterId() {
+ return clusterId;
+ }
+
+ public void setClusterId(String clusterId) {
+ this.clusterId = clusterId;
+ }
+
+ public String getDbName() {
+ return dbName;
+ }
+
+ public void setDbName(String dbName) {
+ this.dbName = dbName;
+ }
+
+ public String getCollectionName() {
+ return collectionName;
+ }
+
+ public void setCollectionName(String collectionName) {
+ this.collectionName = collectionName;
+ }
+
+ public String getPartitionName() {
+ return partitionName;
+ }
+
+ public void setPartitionName(String partitionName) {
+ this.partitionName = partitionName;
+ }
+
+ public String getStageName() {
+ return stageName;
+ }
+
+ public void setStageName(String stageName) {
+ this.stageName = stageName;
+ }
+
+ public List> getDataPaths() {
+ return dataPaths;
+ }
+
+ public void setDataPaths(List> dataPaths) {
+ this.dataPaths = dataPaths;
+ }
+
+ @Override
+ public String toString() {
+ return "StageImportRequest{" +
+ "clusterId='" + clusterId + '\'' +
+ ", dbName='" + dbName + '\'' +
+ ", collectionName='" + collectionName + '\'' +
+ ", partitionName='" + partitionName + '\'' +
+ ", stageName='" + stageName + '\'' +
+ ", dataPaths=" + dataPaths +
+ '}';
+ }
+
+ public static StageImportRequestBuilder builder() {
+ return new StageImportRequestBuilder();
+ }
+
+ public static class StageImportRequestBuilder extends BaseImportRequestBuilder {
+ private String clusterId;
+ private String dbName;
+ private String collectionName;
+ private String partitionName;
+ private String stageName;
+ private List> dataPaths;
+
+ private StageImportRequestBuilder() {
+ this.clusterId = "";
+ this.dbName = "";
+ this.collectionName = "";
+ this.partitionName = "";
+ this.stageName = "";
+ this.dataPaths = new ArrayList<>();
+ }
+
+ public StageImportRequestBuilder clusterId(String clusterId) {
+ this.clusterId = clusterId;
+ return this;
+ }
+
+ public StageImportRequestBuilder dbName(String dbName) {
+ this.dbName = dbName;
+ return this;
+ }
+
+ public StageImportRequestBuilder collectionName(String collectionName) {
+ this.collectionName = collectionName;
+ return this;
+ }
+
+ public StageImportRequestBuilder partitionName(String partitionName) {
+ this.partitionName = partitionName;
+ return this;
+ }
+
+ public StageImportRequestBuilder stageName(String stageName) {
+ this.stageName = stageName;
+ return this;
+ }
+
+ public StageImportRequestBuilder dataPaths(List> dataPaths) {
+ this.dataPaths = dataPaths;
+ return this;
+ }
+
+ public StageImportRequest build() {
+ return new StageImportRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/list/BaseListImportJobsRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/list/BaseListImportJobsRequest.java
index d2e8101e2..c6cff72d9 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/list/BaseListImportJobsRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/list/BaseListImportJobsRequest.java
@@ -19,18 +19,8 @@
package io.milvus.bulkwriter.request.list;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
import java.io.Serializable;
-
-@Data
-@SuperBuilder(toBuilder = true)
-@AllArgsConstructor
-@NoArgsConstructor
public class BaseListImportJobsRequest implements Serializable {
private static final long serialVersionUID = -1890380396466908530L;
/**
@@ -38,4 +28,51 @@ public class BaseListImportJobsRequest implements Serializable {
* If you are using Milvus directly, this parameter should be set to your userName:password.
*/
private String apiKey;
+
+ protected BaseListImportJobsRequest() {
+ }
+
+ protected BaseListImportJobsRequest(String apiKey) {
+ this.apiKey = apiKey;
+ }
+
+ protected BaseListImportJobsRequest(BaseListImportJobsRequestBuilder> builder) {
+ this.apiKey = builder.apiKey;
+ }
+
+ public String getApiKey() {
+ return apiKey;
+ }
+
+ public void setApiKey(String apiKey) {
+ this.apiKey = apiKey;
+ }
+
+ @Override
+ public String toString() {
+ return "BaseListImportJobsRequest{" +
+ "apiKey='" + apiKey + '\'' +
+ '}';
+ }
+
+ public static BaseListImportJobsRequestBuilder> builder() {
+ return new BaseListImportJobsRequestBuilder<>();
+ }
+
+ public static class BaseListImportJobsRequestBuilder> {
+ private String apiKey = "";
+
+ protected BaseListImportJobsRequestBuilder() {
+ this.apiKey = "";
+ }
+
+ public T apiKey(String apiKey) {
+ this.apiKey = apiKey;
+ return (T) this;
+ }
+
+ public BaseListImportJobsRequest build() {
+ return new BaseListImportJobsRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/list/CloudListImportJobsRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/list/CloudListImportJobsRequest.java
index e614dfb51..a03608b5c 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/list/CloudListImportJobsRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/list/CloudListImportJobsRequest.java
@@ -19,18 +19,93 @@
package io.milvus.bulkwriter.request.list;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-@Data
-@SuperBuilder
-@AllArgsConstructor
-@NoArgsConstructor
public class CloudListImportJobsRequest extends BaseListImportJobsRequest {
private static final long serialVersionUID = -3380786382584854649L;
private String clusterId;
private Integer pageSize;
private Integer currentPage;
+
+ protected CloudListImportJobsRequest() {
+ }
+
+ protected CloudListImportJobsRequest(String clusterId, Integer pageSize, Integer currentPage) {
+ this.clusterId = clusterId;
+ this.pageSize = pageSize;
+ this.currentPage = currentPage;
+ }
+
+ protected CloudListImportJobsRequest(CloudListImportJobsRequestBuilder builder) {
+ super(builder);
+ this.clusterId = builder.clusterId;
+ this.pageSize = builder.pageSize;
+ this.currentPage = builder.currentPage;
+ }
+
+ public String getClusterId() {
+ return clusterId;
+ }
+
+ public void setClusterId(String clusterId) {
+ this.clusterId = clusterId;
+ }
+
+ public Integer getPageSize() {
+ return pageSize;
+ }
+
+ public void setPageSize(Integer pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ public Integer getCurrentPage() {
+ return currentPage;
+ }
+
+ public void setCurrentPage(Integer currentPage) {
+ this.currentPage = currentPage;
+ }
+
+ @Override
+ public String toString() {
+ return "CloudListImportJobsRequest{" +
+ "clusterId='" + clusterId + '\'' +
+ "pageSize=" + pageSize +
+ "currentPage=" + currentPage +
+ '}';
+ }
+
+ public static CloudListImportJobsRequestBuilder builder() {
+ return new CloudListImportJobsRequestBuilder();
+ }
+
+ public static class CloudListImportJobsRequestBuilder extends BaseListImportJobsRequestBuilder {
+ private String clusterId;
+ private Integer pageSize;
+ private Integer currentPage;
+
+ private CloudListImportJobsRequestBuilder() {
+ this.clusterId = "";
+ this.pageSize = 0;
+ this.currentPage = 0;
+ }
+
+ public CloudListImportJobsRequestBuilder clusterId(String clusterId) {
+ this.clusterId = clusterId;
+ return this;
+ }
+
+ public CloudListImportJobsRequestBuilder pageSize(Integer pageSize) {
+ this.pageSize = pageSize;
+ return this;
+ }
+
+ public CloudListImportJobsRequestBuilder currentPage(Integer currentPage) {
+ this.currentPage = currentPage;
+ return this;
+ }
+
+ public CloudListImportJobsRequest build() {
+ return new CloudListImportJobsRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/list/MilvusListImportJobsRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/list/MilvusListImportJobsRequest.java
index 4cb4bb935..fd6a7aef8 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/list/MilvusListImportJobsRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/list/MilvusListImportJobsRequest.java
@@ -19,16 +19,55 @@
package io.milvus.bulkwriter.request.list;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-@Data
-@SuperBuilder
-@AllArgsConstructor
-@NoArgsConstructor
public class MilvusListImportJobsRequest extends BaseListImportJobsRequest {
private static final long serialVersionUID = 8957739122547766268L;
private String collectionName;
+
+ protected MilvusListImportJobsRequest() {
+ }
+
+ protected MilvusListImportJobsRequest(String collectionName) {
+ this.collectionName = collectionName;
+ }
+
+ protected MilvusListImportJobsRequest(MilvusListImportJobsRequestBuilder builder) {
+ super(builder);
+ this.collectionName = builder.collectionName;
+ }
+
+ public String getCollectionName() {
+ return collectionName;
+ }
+
+ public void setCollectionName(String collectionName) {
+ this.collectionName = collectionName;
+ }
+
+ @Override
+ public String toString() {
+ return "MilvusListImportJobsRequest{" +
+ "collectionName='" + collectionName + '\'' +
+ '}';
+ }
+
+ public static MilvusListImportJobsRequestBuilder builder() {
+ return new MilvusListImportJobsRequestBuilder();
+ }
+
+ public static class MilvusListImportJobsRequestBuilder extends BaseListImportJobsRequestBuilder {
+ private String collectionName;
+
+ private MilvusListImportJobsRequestBuilder() {
+ this.collectionName = "";
+ }
+
+ public MilvusListImportJobsRequestBuilder collectionName(String collectionName) {
+ this.collectionName = collectionName;
+ return this;
+ }
+
+ public MilvusListImportJobsRequest build() {
+ return new MilvusListImportJobsRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/ApplyStageRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/ApplyStageRequest.java
index 8ddeba45c..332c56150 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/ApplyStageRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/ApplyStageRequest.java
@@ -19,16 +19,73 @@
package io.milvus.bulkwriter.request.stage;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-@Data
-@SuperBuilder
-@AllArgsConstructor
-@NoArgsConstructor
public class ApplyStageRequest extends BaseStageRequest {
private String stageName;
private String path;
+
+ protected ApplyStageRequest() {
+ }
+
+ protected ApplyStageRequest(String stageName, String path) {
+ this.stageName = stageName;
+ this.path = path;
+ }
+
+ protected ApplyStageRequest(ApplyStageRequestBuilder builder) {
+ super(builder);
+ this.stageName = builder.stageName;
+ this.path = builder.path;
+ }
+
+ public String getStageName() {
+ return stageName;
+ }
+
+ public void setStageName(String stageName) {
+ this.stageName = stageName;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ @Override
+ public String toString() {
+ return "ApplyStageRequest{" +
+ "stageName='" + stageName + '\'' +
+ ", path='" + path + '\'' +
+ '}';
+ }
+
+ public static ApplyStageRequestBuilder builder() {
+ return new ApplyStageRequestBuilder();
+ }
+
+ public static class ApplyStageRequestBuilder extends BaseStageRequestBuilder {
+ private String stageName;
+ private String path;
+
+ private ApplyStageRequestBuilder() {
+ this.stageName = "";
+ this.path = "";
+ }
+
+ public ApplyStageRequestBuilder stageName(String stageName) {
+ this.stageName = stageName;
+ return this;
+ }
+
+ public ApplyStageRequestBuilder path(String path) {
+ this.path = path;
+ return this;
+ }
+
+ public ApplyStageRequest build() {
+ return new ApplyStageRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/BaseStageRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/BaseStageRequest.java
index a0f732eac..05877b62f 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/BaseStageRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/BaseStageRequest.java
@@ -19,24 +19,80 @@
package io.milvus.bulkwriter.request.stage;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
import java.io.Serializable;
+import java.util.HashMap;
import java.util.Map;
-@Data
-@SuperBuilder(toBuilder = true)
-@AllArgsConstructor
-@NoArgsConstructor
public class BaseStageRequest implements Serializable {
private static final long serialVersionUID = 8192049841043084620L;
/**
* If you are calling the cloud API, this parameter needs to be filled in; otherwise, you can ignore it.
*/
private String apiKey;
-
private Map options;
+
+ protected BaseStageRequest() {
+ }
+
+ protected BaseStageRequest(String apiKey, Map options) {
+ this.apiKey = apiKey;
+ this.options = options;
+ }
+
+ protected BaseStageRequest(BaseStageRequestBuilder> builder) {
+ this.apiKey = builder.apiKey;
+ this.options = builder.options;
+ }
+
+ public String getApiKey() {
+ return apiKey;
+ }
+
+ public void setApiKey(String apiKey) {
+ this.apiKey = apiKey;
+ }
+
+ public Map getOptions() {
+ return options;
+ }
+
+ public void setOptions(Map options) {
+ this.options = options;
+ }
+
+ @Override
+ public String toString() {
+ return "BaseStageRequest{" +
+ "apiKey='" + apiKey + '\'' +
+ "options=" + options +
+ '}';
+ }
+
+ public static BaseStageRequestBuilder> builder() {
+ return new BaseStageRequestBuilder<>();
+ }
+
+ public static class BaseStageRequestBuilder> {
+ private String apiKey;
+ private Map options;
+
+ protected BaseStageRequestBuilder() {
+ this.apiKey = "";
+ this.options = new HashMap<>();
+ }
+
+ public T apiKey(String apiKey) {
+ this.apiKey = apiKey;
+ return (T) this;
+ }
+
+ public T options(Map options) {
+ this.options = options;
+ return (T) this;
+ }
+
+ public BaseStageRequest build() {
+ return new BaseStageRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/CreateStageRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/CreateStageRequest.java
index 9420ea13b..2ea8b11a9 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/CreateStageRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/CreateStageRequest.java
@@ -19,17 +19,91 @@
package io.milvus.bulkwriter.request.stage;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-@Data
-@SuperBuilder
-@AllArgsConstructor
-@NoArgsConstructor
public class CreateStageRequest {
private String projectId;
private String regionId;
private String stageName;
+
+ public CreateStageRequest() {
+ }
+
+ public CreateStageRequest(String projectId, String regionId, String stageName) {
+ this.projectId = projectId;
+ this.regionId = regionId;
+ this.stageName = stageName;
+ }
+
+ protected CreateStageRequest(CreateStageRequestBuilder builder) {
+ this.projectId = builder.projectId;
+ this.regionId = builder.regionId;
+ this.stageName = builder.stageName;
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getRegionId() {
+ return regionId;
+ }
+
+ public void setRegionId(String regionId) {
+ this.regionId = regionId;
+ }
+
+ public String getStageName() {
+ return stageName;
+ }
+
+ public void setStageName(String stageName) {
+ this.stageName = stageName;
+ }
+
+ @Override
+ public String toString() {
+ return "CreateStageRequest{" +
+ "projectId='" + projectId + '\'' +
+ ", regionId='" + regionId + '\'' +
+ ", stageName='" + stageName + '\'' +
+ '}';
+ }
+
+ public static CreateStageRequestBuilder builder() {
+ return new CreateStageRequestBuilder();
+ }
+
+ public static class CreateStageRequestBuilder {
+ private String projectId;
+ private String regionId;
+ private String stageName;
+
+ private CreateStageRequestBuilder() {
+ this.projectId = "";
+ this.regionId = "";
+ this.stageName = "";
+ }
+
+ public CreateStageRequestBuilder projectId(String projectId) {
+ this.projectId = projectId;
+ return this;
+ }
+
+ public CreateStageRequestBuilder regionId(String regionId) {
+ this.regionId = regionId;
+ return this;
+ }
+
+ public CreateStageRequestBuilder stageName(String stageName) {
+ this.stageName = stageName;
+ return this;
+ }
+
+ public CreateStageRequest build() {
+ return new CreateStageRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/DeleteStageRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/DeleteStageRequest.java
index f90d3d19c..330454da9 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/DeleteStageRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/DeleteStageRequest.java
@@ -19,15 +19,53 @@
package io.milvus.bulkwriter.request.stage;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-@Data
-@SuperBuilder
-@AllArgsConstructor
-@NoArgsConstructor
public class DeleteStageRequest {
private String stageName;
+
+ public DeleteStageRequest() {
+ }
+
+ public DeleteStageRequest(String stageName) {
+ this.stageName = stageName;
+ }
+
+ protected DeleteStageRequest(DeleteStageRequestBuilder builder) {
+ this.stageName = builder.stageName;
+ }
+
+ public String getStageName() {
+ return stageName;
+ }
+
+ public void setStageName(String stageName) {
+ this.stageName = stageName;
+ }
+
+ @Override
+ public String toString() {
+ return "DeleteStageRequest{" +
+ "stageName='" + stageName + '\'' +
+ '}';
+ }
+
+ public static DeleteStageRequestBuilder builder() {
+ return new DeleteStageRequestBuilder();
+ }
+
+ public static class DeleteStageRequestBuilder {
+ private String stageName;
+
+ private DeleteStageRequestBuilder() {
+ this.stageName = "";
+ }
+
+ public DeleteStageRequestBuilder stageName(String stageName) {
+ this.stageName = stageName;
+ return this;
+ }
+
+ public DeleteStageRequest build() {
+ return new DeleteStageRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/ListStagesRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/ListStagesRequest.java
index 6b24cd60e..9aa4b8a0f 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/ListStagesRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/ListStagesRequest.java
@@ -19,17 +19,92 @@
package io.milvus.bulkwriter.request.stage;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-@Data
-@SuperBuilder
-@AllArgsConstructor
-@NoArgsConstructor
+
public class ListStagesRequest {
private String projectId;
private Integer pageSize;
private Integer currentPage;
+
+ public ListStagesRequest() {
+ }
+
+ public ListStagesRequest(String projectId, Integer pageSize, Integer currentPage) {
+ this.projectId = projectId;
+ this.pageSize = pageSize;
+ this.currentPage = currentPage;
+ }
+
+ protected ListStagesRequest(ListStagesRequestBuilder builder) {
+ this.projectId = builder.projectId;
+ this.pageSize = builder.pageSize;
+ this.currentPage = builder.currentPage;
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public Integer getPageSize() {
+ return pageSize;
+ }
+
+ public void setPageSize(Integer pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ public Integer getCurrentPage() {
+ return currentPage;
+ }
+
+ public void setCurrentPage(Integer currentPage) {
+ this.currentPage = currentPage;
+ }
+
+ @Override
+ public String toString() {
+ return "ListStagesRequest{" +
+ "projectId='" + projectId + '\'' +
+ ", pageSize=" + pageSize +
+ ", currentPage=" + currentPage +
+ '}';
+ }
+
+ public static ListStagesRequestBuilder builder() {
+ return new ListStagesRequestBuilder();
+ }
+
+ public static class ListStagesRequestBuilder {
+ private String projectId;
+ private Integer pageSize;
+ private Integer currentPage;
+
+ private ListStagesRequestBuilder() {
+ this.projectId = "";
+ this.pageSize = 0;
+ this.currentPage = 0;
+ }
+
+ public ListStagesRequestBuilder projectId(String projectId) {
+ this.projectId = projectId;
+ return this;
+ }
+
+ public ListStagesRequestBuilder pageSize(Integer pageSize) {
+ this.pageSize = pageSize;
+ return this;
+ }
+
+ public ListStagesRequestBuilder currentPage(Integer currentPage) {
+ this.currentPage = currentPage;
+ return this;
+ }
+
+ public ListStagesRequest build() {
+ return new ListStagesRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/UploadFilesRequest.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/UploadFilesRequest.java
index d749d12d4..ed87779a3 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/UploadFilesRequest.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/request/stage/UploadFilesRequest.java
@@ -19,15 +19,6 @@
package io.milvus.bulkwriter.request.stage;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-@Data
-@SuperBuilder
-@AllArgsConstructor
-@NoArgsConstructor
public class UploadFilesRequest {
/**
* The full path of a local file or directory:
@@ -42,4 +33,69 @@ public class UploadFilesRequest {
* To upload to a specific folder, end the path with a /, e.g., data/
*/
private String targetStagePath;
+
+ public UploadFilesRequest() {
+ }
+
+ public UploadFilesRequest(String sourceFilePath, String targetStagePath) {
+ this.sourceFilePath = sourceFilePath;
+ this.targetStagePath = targetStagePath;
+ }
+
+ protected UploadFilesRequest(UploadFilesRequestBuilder builder) {
+ this.sourceFilePath = builder.sourceFilePath;
+ this.targetStagePath = builder.targetStagePath;
+ }
+
+ public String getSourceFilePath() {
+ return sourceFilePath;
+ }
+
+ public void setSourceFilePath(String sourceFilePath) {
+ this.sourceFilePath = sourceFilePath;
+ }
+
+ public String getTargetStagePath() {
+ return targetStagePath;
+ }
+
+ public void setTargetStagePath(String targetStagePath) {
+ this.targetStagePath = targetStagePath;
+ }
+
+ @Override
+ public String toString() {
+ return "UploadFilesRequest{" +
+ "sourceFilePath='" + sourceFilePath + '\'' +
+ ", targetStagePath='" + targetStagePath + '\'' +
+ '}';
+ }
+
+ public static UploadFilesRequestBuilder builder() {
+ return new UploadFilesRequestBuilder();
+ }
+
+ public static class UploadFilesRequestBuilder {
+ private String sourceFilePath;
+ private String targetStagePath;
+
+ private UploadFilesRequestBuilder() {
+ this.sourceFilePath = "";
+ this.targetStagePath = "";
+ }
+
+ public UploadFilesRequestBuilder sourceFilePath(String sourceFilePath) {
+ this.sourceFilePath = sourceFilePath;
+ return this;
+ }
+
+ public UploadFilesRequestBuilder targetStagePath(String targetStagePath) {
+ this.targetStagePath = targetStagePath;
+ return this;
+ }
+
+ public UploadFilesRequest build() {
+ return new UploadFilesRequest(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/ApplyStageResponse.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/ApplyStageResponse.java
index de13d981f..b41b9fe56 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/ApplyStageResponse.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/ApplyStageResponse.java
@@ -1,55 +1,367 @@
package io.milvus.bulkwriter.response;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
import java.io.Serializable;
-@Data
-@SuperBuilder
-@AllArgsConstructor
-@NoArgsConstructor
public class ApplyStageResponse implements Serializable {
private String endpoint;
-
private String cloud;
-
private String region;
-
private String bucketName;
-
private String uploadPath;
-
private Credentials credentials;
-
private Condition condition;
-
private String stageName;
-
private String stagePrefix;
- @AllArgsConstructor
- @NoArgsConstructor
- @Data
- @Builder
+ public ApplyStageResponse() {
+ }
+
+ public ApplyStageResponse(String endpoint, String cloud, String region, String bucketName, String uploadPath,
+ Credentials credentials, Condition condition, String stageName, String stagePrefix) {
+ this.endpoint = endpoint;
+ this.cloud = cloud;
+ this.region = region;
+ this.bucketName = bucketName;
+ this.uploadPath = uploadPath;
+ this.credentials = credentials;
+ this.condition = condition;
+ this.stageName = stageName;
+ this.stagePrefix = stagePrefix;
+ }
+
+ private ApplyStageResponse(ApplyStageResponseBuilder builder) {
+ this.endpoint = builder.endpoint;
+ this.cloud = builder.cloud;
+ this.region = builder.region;
+ this.bucketName = builder.bucketName;
+ this.uploadPath = builder.uploadPath;
+ this.credentials = builder.credentials;
+ this.condition = builder.condition;
+ this.stageName = builder.stageName;
+ this.stagePrefix = builder.stagePrefix;
+ }
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public String getCloud() {
+ return cloud;
+ }
+
+ public void setCloud(String cloud) {
+ this.cloud = cloud;
+ }
+
+ public String getRegion() {
+ return region;
+ }
+
+ public void setRegion(String region) {
+ this.region = region;
+ }
+
+ public String getBucketName() {
+ return bucketName;
+ }
+
+ public void setBucketName(String bucketName) {
+ this.bucketName = bucketName;
+ }
+
+ public String getUploadPath() {
+ return uploadPath;
+ }
+
+ public void setUploadPath(String uploadPath) {
+ this.uploadPath = uploadPath;
+ }
+
+ public Credentials getCredentials() {
+ return credentials;
+ }
+
+ public void setCredentials(Credentials credentials) {
+ this.credentials = credentials;
+ }
+
+ public Condition getCondition() {
+ return condition;
+ }
+
+ public void setCondition(Condition condition) {
+ this.condition = condition;
+ }
+
+ public String getStageName() {
+ return stageName;
+ }
+
+ public void setStageName(String stageName) {
+ this.stageName = stageName;
+ }
+
+ public String getStagePrefix() {
+ return stagePrefix;
+ }
+
+ public void setStagePrefix(String stagePrefix) {
+ this.stagePrefix = stagePrefix;
+ }
+
+ @Override
+ public String toString() {
+ return "ApplyStageResponse{" +
+ ", endpoint='" + endpoint + '\'' +
+ ", cloud='" + cloud + '\'' +
+ ", region='" + region + '\'' +
+ ", bucketName='" + bucketName + '\'' +
+ ", uploadPath='" + uploadPath + '\'' +
+ ", credentials=" + credentials +
+ ", condition=" + condition +
+ ", stageName='" + stageName + '\'' +
+ ", stagePrefix='" + stagePrefix + '\'' +
+ '}';
+ }
+
+ public static ApplyStageResponseBuilder builder() {
+ return new ApplyStageResponseBuilder();
+ }
+
+ public static class ApplyStageResponseBuilder {
+ private String endpoint;
+ private String cloud;
+ private String region;
+ private String bucketName;
+ private String uploadPath;
+ private Credentials credentials;
+ private Condition condition;
+ private String stageName;
+ private String stagePrefix;
+
+ private ApplyStageResponseBuilder() {
+ this.endpoint = "";
+ this.cloud = "";
+ this.region = "";
+ this.bucketName = "";
+ this.uploadPath = "";
+ this.credentials = new Credentials();
+ this.condition = new Condition();
+ this.stageName = "";
+ this.stagePrefix = "";
+ }
+
+ public ApplyStageResponseBuilder endpoint(String endpoint) {
+ this.endpoint = endpoint;
+ return this;
+ }
+
+ public ApplyStageResponseBuilder cloud(String cloud) {
+ this.cloud = cloud;
+ return this;
+ }
+
+ public ApplyStageResponseBuilder region(String region) {
+ this.region = region;
+ return this;
+ }
+
+ public ApplyStageResponseBuilder bucketName(String bucketName) {
+ this.bucketName = bucketName;
+ return this;
+ }
+
+ public ApplyStageResponseBuilder uploadPath(String uploadPath) {
+ this.uploadPath = uploadPath;
+ return this;
+ }
+
+ public ApplyStageResponseBuilder credentials(Credentials credentials) {
+ this.credentials = credentials;
+ return this;
+ }
+
+ public ApplyStageResponseBuilder condition(Condition condition) {
+ this.condition = condition;
+ return this;
+ }
+
+ public ApplyStageResponseBuilder stageName(String stageName) {
+ this.stageName = stageName;
+ return this;
+ }
+
+ public ApplyStageResponseBuilder stagePrefix(String stagePrefix) {
+ this.stagePrefix = stagePrefix;
+ return this;
+ }
+
+ public ApplyStageResponse build() {
+ return new ApplyStageResponse(this);
+ }
+ }
+
public static class Credentials implements Serializable {
private static final long serialVersionUID = 623702599895113789L;
private String tmpAK;
private String tmpSK;
private String sessionToken;
private String expireTime;
+
+ public Credentials() {
+ }
+
+ public Credentials(String tmpAK, String tmpSK, String sessionToken, String expireTime) {
+ this.tmpAK = tmpAK;
+ this.tmpSK = tmpSK;
+ this.sessionToken = sessionToken;
+ this.expireTime = expireTime;
+ }
+
+ private Credentials(CredentialsBuilder builder) {
+ this.tmpAK = builder.tmpAK;
+ this.tmpSK = builder.tmpSK;
+ this.sessionToken = builder.sessionToken;
+ this.expireTime = builder.expireTime;
+ }
+
+ public String getTmpAK() {
+ return tmpAK;
+ }
+
+ public void setTmpAK(String tmpAK) {
+ this.tmpAK = tmpAK;
+ }
+
+ public String getTmpSK() {
+ return tmpSK;
+ }
+
+ public void setTmpSK(String tmpSK) {
+ this.tmpSK = tmpSK;
+ }
+
+ public String getSessionToken() {
+ return sessionToken;
+ }
+
+ public void setSessionToken(String sessionToken) {
+ this.sessionToken = sessionToken;
+ }
+
+ public String getExpireTime() {
+ return expireTime;
+ }
+
+ public void setExpireTime(String expireTime) {
+ this.expireTime = expireTime;
+ }
+
+ @Override
+ public String toString() {
+ return "Credentials{" +
+ ", tmpAK='" + tmpAK + '\'' +
+ ", expireTime='" + expireTime + '\'' +
+ '}';
+ }
+
+ public static CredentialsBuilder builder() {
+ return new CredentialsBuilder();
+ }
+
+ public static class CredentialsBuilder {
+ private String tmpAK;
+ private String tmpSK;
+ private String sessionToken;
+ private String expireTime;
+
+ private CredentialsBuilder() {
+ this.tmpAK = "";
+ this.tmpSK = "";
+ this.sessionToken = "";
+ this.expireTime = "";
+ }
+
+ public CredentialsBuilder tmpAK(String tmpAK) {
+ this.tmpAK = tmpAK;
+ return this;
+ }
+
+ public CredentialsBuilder tmpSK(String tmpSK) {
+ this.tmpSK = tmpSK;
+ return this;
+ }
+
+ public CredentialsBuilder sessionToken(String sessionToken) {
+ this.sessionToken = sessionToken;
+ return this;
+ }
+
+ public CredentialsBuilder expireTime(String expireTime) {
+ this.expireTime = expireTime;
+ return this;
+ }
+
+ public Credentials build() {
+ return new Credentials(this);
+ }
+ }
}
- @AllArgsConstructor
- @NoArgsConstructor
- @Data
- @Builder
public static class Condition implements Serializable {
private static final long serialVersionUID = -2613029991242322109L;
private Long maxContentLength;
+
+ public Condition() {
+ }
+
+ public Condition(Long maxContentLength) {
+ this.maxContentLength = maxContentLength;
+ }
+
+ private Condition(ConditionBuilder builder) {
+ this.maxContentLength = builder.maxContentLength;
+ }
+
+ public Long getMaxContentLength() {
+ return maxContentLength;
+ }
+
+ public void setMaxContentLength(Long maxContentLength) {
+ this.maxContentLength = maxContentLength;
+ }
+
+ @Override
+ public String toString() {
+ return "Condition{" +
+ ", maxContentLength=" + maxContentLength +
+ '}';
+ }
+
+ public static ConditionBuilder builder() {
+ return new ConditionBuilder();
+ }
+
+ public static class ConditionBuilder {
+ private Long maxContentLength;
+
+ private ConditionBuilder() {
+ this.maxContentLength = 0L;
+ }
+
+ public ConditionBuilder maxContentLength(Long maxContentLength) {
+ this.maxContentLength = maxContentLength;
+ return this;
+ }
+
+ public Condition build() {
+ return new Condition(this);
+ }
+ }
}
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/BulkImportResponse.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/BulkImportResponse.java
index ead640d16..f3af05eea 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/BulkImportResponse.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/BulkImportResponse.java
@@ -19,19 +19,56 @@
package io.milvus.bulkwriter.response;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
import java.io.Serializable;
-@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
public class BulkImportResponse implements Serializable {
private static final long serialVersionUID = -7162743560382861611L;
-
private String jobId;
+
+ public BulkImportResponse() {
+ }
+
+ public BulkImportResponse(String jobId) {
+ this.jobId = jobId;
+ }
+
+ private BulkImportResponse(BulkImportResponseBuilder builder) {
+ this.jobId = builder.jobId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ @Override
+ public String toString() {
+ return "BulkImportResponse{" +
+ "jobId='" + jobId + '\'' +
+ '}';
+ }
+
+ public static BulkImportResponseBuilder builder() {
+ return new BulkImportResponseBuilder();
+ }
+
+ public static class BulkImportResponseBuilder {
+ private String jobId;
+
+ private BulkImportResponseBuilder() {
+ this.jobId = "";
+ }
+
+ public BulkImportResponseBuilder jobId(String jobId) {
+ this.jobId = jobId;
+ return this;
+ }
+
+ public BulkImportResponse build() {
+ return new BulkImportResponse(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/GetImportProgressResponse.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/GetImportProgressResponse.java
index 7444bcfb9..e6a87de71 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/GetImportProgressResponse.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/GetImportProgressResponse.java
@@ -19,52 +19,377 @@
package io.milvus.bulkwriter.response;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.List;
-@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
public class GetImportProgressResponse implements Serializable {
-
private static final long serialVersionUID = -2302203037749197132L;
-
private String jobId;
-
private String collectionName;
-
private String fileName;
-
private Integer fileSize;
-
private String state;
-
private Integer progress;
-
private String completeTime;
-
private String reason;
-
private Integer totalRows;
-
private List details;
- @Data
- @Builder
- @AllArgsConstructor
- @NoArgsConstructor
- private static class Detail {
+ public GetImportProgressResponse() {
+ }
+
+ public GetImportProgressResponse(String jobId, String collectionName, String fileName, Integer fileSize,
+ String state, Integer progress, String completeTime, String reason,
+ Integer totalRows, List details) {
+ this.jobId = jobId;
+ this.collectionName = collectionName;
+ this.fileName = fileName;
+ this.fileSize = fileSize;
+ this.state = state;
+ this.progress = progress;
+ this.completeTime = completeTime;
+ this.reason = reason;
+ this.totalRows = totalRows;
+ this.details = details;
+ }
+
+ private GetImportProgressResponse(GetImportProgressResponseBuilder builder) {
+ this.jobId = builder.jobId;
+ this.collectionName = builder.collectionName;
+ this.fileName = builder.fileName;
+ this.fileSize = builder.fileSize;
+ this.state = builder.state;
+ this.progress = builder.progress;
+ this.completeTime = builder.completeTime;
+ this.reason = builder.reason;
+ this.totalRows = builder.totalRows;
+ this.details = builder.details;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getCollectionName() {
+ return collectionName;
+ }
+
+ public void setCollectionName(String collectionName) {
+ this.collectionName = collectionName;
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public Integer getFileSize() {
+ return fileSize;
+ }
+
+ public void setFileSize(Integer fileSize) {
+ this.fileSize = fileSize;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public Integer getProgress() {
+ return progress;
+ }
+
+ public void setProgress(Integer progress) {
+ this.progress = progress;
+ }
+
+ public String getCompleteTime() {
+ return completeTime;
+ }
+
+ public void setCompleteTime(String completeTime) {
+ this.completeTime = completeTime;
+ }
+
+ public String getReason() {
+ return reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+ public Integer getTotalRows() {
+ return totalRows;
+ }
+
+ public void setTotalRows(Integer totalRows) {
+ this.totalRows = totalRows;
+ }
+
+ public List getDetails() {
+ return details;
+ }
+
+ public void setDetails(List details) {
+ this.details = details;
+ }
+
+ @Override
+ public String toString() {
+ return "GetImportProgressResponse{" +
+ "jobId='" + jobId + '\'' +
+ ", collectionName='" + collectionName + '\'' +
+ ", fileName='" + fileName + '\'' +
+ ", fileSize=" + fileSize +
+ ", state='" + state + '\'' +
+ ", progress=" + progress +
+ ", completeTime='" + completeTime + '\'' +
+ ", reason='" + reason + '\'' +
+ ", totalRows=" + totalRows +
+ ", details=" + details +
+ '}';
+ }
+
+ public static Detail.DetailBuilder builder() {
+ return new Detail.DetailBuilder();
+ }
+
+ public static class GetImportProgressResponseBuilder {
+ private String jobId;
+ private String collectionName;
+ private String fileName;
+ private Integer fileSize;
+ private String state;
+ private Integer progress;
+ private String completeTime;
+ private String reason;
+ private Integer totalRows;
+ private List details;
+
+ private GetImportProgressResponseBuilder() {
+ this.jobId = "";
+ this.collectionName = "";
+ this.fileName = "";
+ this.fileSize = 0;
+ this.state = "";
+ this.progress = 0;
+ this.completeTime = "";
+ this.reason = "";
+ this.totalRows = 0;
+ this.details = new ArrayList<>();
+ }
+
+ public GetImportProgressResponseBuilder jobId(String jobId) {
+ this.jobId = jobId;
+ return this;
+ }
+
+ public GetImportProgressResponseBuilder collectionName(String collectionName) {
+ this.collectionName = collectionName;
+ return this;
+ }
+
+ public GetImportProgressResponseBuilder fileName(String fileName) {
+ this.fileName = fileName;
+ return this;
+ }
+
+ public GetImportProgressResponseBuilder fileSize(Integer fileSize) {
+ this.fileSize = fileSize;
+ return this;
+ }
+
+ public GetImportProgressResponseBuilder state(String state) {
+ this.state = state;
+ return this;
+ }
+
+ public GetImportProgressResponseBuilder progress(Integer progress) {
+ this.progress = progress;
+ return this;
+ }
+
+ public GetImportProgressResponseBuilder completeTime(String completeTime) {
+ this.completeTime = completeTime;
+ return this;
+ }
+
+ public GetImportProgressResponseBuilder reason(String reason) {
+ this.reason = reason;
+ return this;
+ }
+
+ public GetImportProgressResponseBuilder totalRows(Integer totalRows) {
+ this.totalRows = totalRows;
+ return this;
+ }
+
+ public GetImportProgressResponseBuilder details(List details) {
+ this.details = details;
+ return this;
+ }
+
+ public GetImportProgressResponse build() {
+ return new GetImportProgressResponse(this);
+ }
+ }
+
+ public static class Detail {
private String fileName;
private Integer fileSize;
private String state;
private Integer progress;
private String completeTime;
private String reason;
+
+ public Detail() {
+ }
+
+ public Detail(String fileName, Integer fileSize, String state, Integer progress, String completeTime, String reason) {
+ this.fileName = fileName;
+ this.fileSize = fileSize;
+ this.state = state;
+ this.progress = progress;
+ this.completeTime = completeTime;
+ this.reason = reason;
+ }
+
+ private Detail(DetailBuilder builder) {
+ this.fileName = builder.fileName;
+ this.fileSize = builder.fileSize;
+ this.state = builder.state;
+ this.progress = builder.progress;
+ this.completeTime = builder.completeTime;
+ this.reason = builder.reason;
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public Integer getFileSize() {
+ return fileSize;
+ }
+
+ public void setFileSize(Integer fileSize) {
+ this.fileSize = fileSize;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public Integer getProgress() {
+ return progress;
+ }
+
+ public void setProgress(Integer progress) {
+ this.progress = progress;
+ }
+
+ public String getCompleteTime() {
+ return completeTime;
+ }
+
+ public void setCompleteTime(String completeTime) {
+ this.completeTime = completeTime;
+ }
+
+ public String getReason() {
+ return reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+ @Override
+ public String toString() {
+ return "Detail{" +
+ "fileName='" + fileName + '\'' +
+ ", fileSize=" + fileSize +
+ ", state='" + state + '\'' +
+ ", progress=" + progress +
+ ", completeTime='" + completeTime + '\'' +
+ ", reason='" + reason + '\'' +
+ '}';
+ }
+
+ public static DetailBuilder builder() {
+ return new DetailBuilder();
+ }
+
+ public static class DetailBuilder {
+ private String fileName;
+ private Integer fileSize;
+ private String state;
+ private Integer progress;
+ private String completeTime;
+ private String reason;
+
+ private DetailBuilder() {
+ this.fileName = "";
+ this.fileSize = 0;
+ this.state = "";
+ this.progress = 0;
+ this.completeTime = "";
+ this.reason = "";
+ }
+
+ public DetailBuilder fileName(String fileName) {
+ this.fileName = fileName;
+ return this;
+ }
+
+ public DetailBuilder fileSize(Integer fileSize) {
+ this.fileSize = fileSize;
+ return this;
+ }
+
+ public DetailBuilder state(String state) {
+ this.state = state;
+ return this;
+ }
+
+ public DetailBuilder progress(Integer progress) {
+ this.progress = progress;
+ return this;
+ }
+
+ public DetailBuilder completeTime(String completeTime) {
+ this.completeTime = completeTime;
+ return this;
+ }
+
+ public DetailBuilder reason(String reason) {
+ this.reason = reason;
+ return this;
+ }
+
+ public Detail build() {
+ return new Detail(this);
+ }
+ }
}
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/ListImportJobsResponse.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/ListImportJobsResponse.java
index f2e9a6558..95aed9348 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/ListImportJobsResponse.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/ListImportJobsResponse.java
@@ -19,27 +19,114 @@
package io.milvus.bulkwriter.response;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.List;
-@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
public class ListImportJobsResponse implements Serializable {
-
private static final long serialVersionUID = -8400893490624599225L;
-
private Integer count;
-
private Integer currentPage;
-
private Integer pageSize;
-
private List records;
+
+ public ListImportJobsResponse() {
+ }
+
+ public ListImportJobsResponse(Integer count, Integer currentPage, Integer pageSize, List records) {
+ this.count = count;
+ this.currentPage = currentPage;
+ this.pageSize = pageSize;
+ this.records = records;
+ }
+
+ private ListImportJobsResponse(ListImportJobsResponseBuilder builder) {
+ this.count = builder.count;
+ this.currentPage = builder.currentPage;
+ this.pageSize = builder.pageSize;
+ this.records = builder.records;
+ }
+
+ public Integer getCount() {
+ return count;
+ }
+
+ public void setCount(Integer count) {
+ this.count = count;
+ }
+
+ public Integer getCurrentPage() {
+ return currentPage;
+ }
+
+ public void setCurrentPage(Integer currentPage) {
+ this.currentPage = currentPage;
+ }
+
+ public Integer getPageSize() {
+ return pageSize;
+ }
+
+ public void setPageSize(Integer pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ public List getRecords() {
+ return records;
+ }
+
+ public void setRecords(List records) {
+ this.records = records;
+ }
+
+ @Override
+ public String toString() {
+ return "ListImportJobsResponse{" +
+ ", count=" + count +
+ ", currentPage=" + currentPage +
+ ", pageSize=" + pageSize +
+ '}';
+ }
+
+ public static ListImportJobsResponseBuilder builder() {
+ return new ListImportJobsResponseBuilder();
+ }
+
+ public static class ListImportJobsResponseBuilder {
+ private Integer count;
+ private Integer currentPage;
+ private Integer pageSize;
+ private List records;
+
+ private ListImportJobsResponseBuilder() {
+ this.count = 0;
+ this.currentPage = 0;
+ this.pageSize = 0;
+ this.records = new ArrayList<>();
+ }
+
+ public ListImportJobsResponseBuilder count(Integer count) {
+ this.count = count;
+ return this;
+ }
+
+ public ListImportJobsResponseBuilder currentPage(Integer currentPage) {
+ this.currentPage = currentPage;
+ return this;
+ }
+
+ public ListImportJobsResponseBuilder pageSize(Integer pageSize) {
+ this.pageSize = pageSize;
+ return this;
+ }
+
+ public ListImportJobsResponseBuilder records(List records) {
+ this.records = records;
+ return this;
+ }
+
+ public ListImportJobsResponse build() {
+ return new ListImportJobsResponse(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/Record.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/Record.java
index 1ca30b4d0..3bf16d131 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/Record.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/Record.java
@@ -1,16 +1,90 @@
package io.milvus.bulkwriter.response;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
public class Record {
private String collectionName;
private String jobId;
private String state;
+
+ public Record() {
+ }
+
+ public Record(String collectionName, String jobId, String state) {
+ this.collectionName = collectionName;
+ this.jobId = jobId;
+ this.state = state;
+ }
+
+ private Record(RecordBuilder builder) {
+ this.collectionName = builder.collectionName;
+ this.jobId = builder.jobId;
+ this.state = builder.state;
+ }
+
+ public String getCollectionName() {
+ return collectionName;
+ }
+
+ public void setCollectionName(String collectionName) {
+ this.collectionName = collectionName;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ @Override
+ public String toString() {
+ return "Record{" +
+ "collectionName='" + collectionName + '\'' +
+ ", jobId='" + jobId + '\'' +
+ ", state='" + state + '\'' +
+ '}';
+ }
+
+ public static RecordBuilder builder() {
+ return new RecordBuilder();
+ }
+
+ public static class RecordBuilder {
+ private String collectionName;
+ private String jobId;
+ private String state;
+
+ private RecordBuilder() {
+ this.collectionName = "";
+ this.jobId = "";
+ this.state = "";
+ }
+
+ public RecordBuilder collectionName(String collectionName) {
+ this.collectionName = collectionName;
+ return this;
+ }
+
+ public RecordBuilder jobId(String jobId) {
+ this.jobId = jobId;
+ return this;
+ }
+
+ public RecordBuilder state(String state) {
+ this.state = state;
+ return this;
+ }
+
+ public Record build() {
+ return new Record(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/RestfulResponse.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/RestfulResponse.java
index 7181c008e..7a1c11c95 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/RestfulResponse.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/RestfulResponse.java
@@ -19,23 +19,93 @@
package io.milvus.bulkwriter.response;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
import java.io.Serializable;
-@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
public class RestfulResponse implements Serializable {
private static final long serialVersionUID = -7162743560382861611L;
-
private int code;
-
private String message;
-
private T data;
+
+ public RestfulResponse() {
+ }
+
+ public RestfulResponse(int code, String message, T data) {
+ this.code = code;
+ this.message = message;
+ this.data = data;
+ }
+
+ private RestfulResponse(RestfulResponseBuilder builder) {
+ this.code = builder.code;
+ this.message = builder.message;
+ this.data = builder.data;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public T getData() {
+ return data;
+ }
+
+ public void setData(T data) {
+ this.data = data;
+ }
+
+ @Override
+ public String toString() {
+ return "RestfulResponse{" +
+ "code=" + code +
+ ", message='" + message + '\'' +
+ '}';
+ }
+
+ public static RestfulResponseBuilder> builder() {
+ return new RestfulResponseBuilder<>();
+ }
+
+ public static class RestfulResponseBuilder {
+ private int code;
+ private String message;
+ private T data;
+
+ private RestfulResponseBuilder() {
+ this.code = 0;
+ this.message = "";
+ this.data = null;
+ }
+
+ public RestfulResponseBuilder code(int code) {
+ this.code = code;
+ return this;
+ }
+
+ public RestfulResponseBuilder message(String message) {
+ this.message = message;
+ return this;
+ }
+
+ public RestfulResponseBuilder data(T data) {
+ this.data = data;
+ return this;
+ }
+
+ public RestfulResponse build() {
+ return new RestfulResponse<>(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/stage/ListStagesResponse.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/stage/ListStagesResponse.java
index ca045ebb1..7e0d302e1 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/stage/ListStagesResponse.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/stage/ListStagesResponse.java
@@ -19,24 +19,112 @@
package io.milvus.bulkwriter.response.stage;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
+import java.util.ArrayList;
import java.util.List;
-@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
public class ListStagesResponse {
-
private Integer count;
-
private Integer currentPage;
-
private Integer pageSize;
-
private List stages;
+
+ public ListStagesResponse() {
+ }
+
+ public ListStagesResponse(Integer count, Integer currentPage, Integer pageSize, List stages) {
+ this.count = count;
+ this.currentPage = currentPage;
+ this.pageSize = pageSize;
+ this.stages = stages;
+ }
+
+ private ListStagesResponse(ListStagesResponseBuilder builder) {
+ this.count = builder.count;
+ this.currentPage = builder.currentPage;
+ this.pageSize = builder.pageSize;
+ this.stages = builder.stages;
+ }
+
+ public Integer getCount() {
+ return count;
+ }
+
+ public void setCount(Integer count) {
+ this.count = count;
+ }
+
+ public Integer getCurrentPage() {
+ return currentPage;
+ }
+
+ public void setCurrentPage(Integer currentPage) {
+ this.currentPage = currentPage;
+ }
+
+ public Integer getPageSize() {
+ return pageSize;
+ }
+
+ public void setPageSize(Integer pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ public List getStages() {
+ return stages;
+ }
+
+ public void setStages(List stages) {
+ this.stages = stages;
+ }
+
+ @Override
+ public String toString() {
+ return "ListStagesResponse{" +
+ ", count=" + count +
+ ", currentPage=" + currentPage +
+ ", pageSize=" + pageSize +
+ '}';
+ }
+
+ public static ListStagesResponseBuilder builder() {
+ return new ListStagesResponseBuilder();
+ }
+
+ public static class ListStagesResponseBuilder {
+ private Integer count;
+ private Integer currentPage;
+ private Integer pageSize;
+ private List stages;
+
+ private ListStagesResponseBuilder() {
+ this.count = 0;
+ this.currentPage = 0;
+ this.pageSize = 0;
+ this.stages = new ArrayList<>();
+ }
+
+ public ListStagesResponseBuilder count(Integer count) {
+ this.count = count;
+ return this;
+ }
+
+ public ListStagesResponseBuilder currentPage(Integer currentPage) {
+ this.currentPage = currentPage;
+ return this;
+ }
+
+ public ListStagesResponseBuilder pageSize(Integer pageSize) {
+ this.pageSize = pageSize;
+ return this;
+ }
+
+ public ListStagesResponseBuilder stages(List stages) {
+ this.stages = stages;
+ return this;
+ }
+
+ public ListStagesResponse build() {
+ return new ListStagesResponse(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/stage/StageInfo.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/stage/StageInfo.java
index 84899f7f4..41a322a2d 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/stage/StageInfo.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/stage/StageInfo.java
@@ -1,14 +1,52 @@
package io.milvus.bulkwriter.response.stage;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
public class StageInfo {
private String stageName;
+
+ public StageInfo() {
+ }
+
+ public StageInfo(String stageName) {
+ this.stageName = stageName;
+ }
+
+ private StageInfo(StageInfoBuilder builder) {
+ this.stageName = builder.stageName;
+ }
+
+ public String getStageName() {
+ return stageName;
+ }
+
+ public void setStageName(String stageName) {
+ this.stageName = stageName;
+ }
+
+ @Override
+ public String toString() {
+ return "StageInfo{" +
+ "stageName='" + stageName + '\'' +
+ '}';
+ }
+
+ public static StageInfoBuilder builder() {
+ return new StageInfoBuilder();
+ }
+
+ public static class StageInfoBuilder {
+ private String stageName;
+
+ private StageInfoBuilder() {
+ this.stageName = "";
+ }
+
+ public StageInfoBuilder stageName(String stageName) {
+ this.stageName = stageName;
+ return this;
+ }
+
+ public StageInfo build() {
+ return new StageInfo(this);
+ }
+ }
}
diff --git a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/restful/BulkImportUtils.java b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/restful/BulkImportUtils.java
index d7c81c1cd..ffaf4f4f0 100644
--- a/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/restful/BulkImportUtils.java
+++ b/sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/restful/BulkImportUtils.java
@@ -33,9 +33,11 @@ public class BulkImportUtils extends BaseRestful {
public static String bulkImport(String url, BaseImportRequest request) {
String requestURL = url + "/v2/vectordb/jobs/import/create";
- Map params = JsonUtils.fromJson(JsonUtils.toJson(request), new TypeToken