|
@@ -1,11 +1,14 @@
|
|
package io.milvus.response;
|
|
package io.milvus.response;
|
|
|
|
|
|
|
|
+import io.milvus.exception.IllegalResponseException;
|
|
|
|
+import io.milvus.exception.MilvusException;
|
|
import io.milvus.grpc.GetImportStateResponse;
|
|
import io.milvus.grpc.GetImportStateResponse;
|
|
import io.milvus.grpc.ImportState;
|
|
import io.milvus.grpc.ImportState;
|
|
import io.milvus.grpc.KeyValuePair;
|
|
import io.milvus.grpc.KeyValuePair;
|
|
import io.milvus.param.Constant;
|
|
import io.milvus.param.Constant;
|
|
import lombok.NonNull;
|
|
import lombok.NonNull;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -33,7 +36,22 @@ public class GetBulkloadStateWrapper {
|
|
* @return List<Long> ID array returned by bulk load task
|
|
* @return List<Long> ID array returned by bulk load task
|
|
*/
|
|
*/
|
|
public List<Long> getAutoGeneratedIDs() {
|
|
public List<Long> getAutoGeneratedIDs() {
|
|
- return response.getIdListList();
|
|
|
|
|
|
+ // the id list of response is id ranges
|
|
|
|
+ // for example, if the response return [1, 100, 200, 250]
|
|
|
|
+ // the full id list should be [1, 2, 3 ... , 99, 100, 200, 201, 202 ... , 249, 250]
|
|
|
|
+ List<Long> ranges = response.getIdListList();
|
|
|
|
+ if (ranges.size()%2 != 0) {
|
|
|
|
+ throw new IllegalResponseException("The bulkload state response id range list is illegal");
|
|
|
|
+ }
|
|
|
|
+ List<Long> ids = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < ranges.size()/2; i++) {
|
|
|
|
+ Long begin = ranges.get(i*2);
|
|
|
|
+ Long end = ranges.get(i*2+1);
|
|
|
|
+ for (long j = begin; j <= end; j++) {
|
|
|
|
+ ids.add(j);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return ids;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -73,21 +91,39 @@ public class GetBulkloadStateWrapper {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * A flag indicating (heuristically) whether import data are queryable (i.e. loaded in query nodes).
|
|
|
|
|
|
+ * Gets target collection name of the bulk load task.
|
|
|
|
+ *
|
|
|
|
+ * @return String target collection name
|
|
|
|
+ */
|
|
|
|
+ public String getCollectionName() {
|
|
|
|
+ return getInfo(Constant.IMPORT_COLLECTION);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Gets target partition name of the bulk load task.
|
|
|
|
+ *
|
|
|
|
+ * @return String target partition name
|
|
|
|
+ */
|
|
|
|
+ public String getPartitionName() {
|
|
|
|
+ return getInfo(Constant.IMPORT_PARTITION);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * A flag indicating whether import data are queryable (i.e. loaded in query nodes).
|
|
*
|
|
*
|
|
- * @return boolean whether import data are queryable(heuristically)
|
|
|
|
|
|
+ * @return boolean whether import data are queryable
|
|
*/
|
|
*/
|
|
- public boolean HeuristicQueryable() {
|
|
|
|
- return response.getHeuristicDataQueryable();
|
|
|
|
|
|
+ public boolean queryable() {
|
|
|
|
+ return response.getDataQueryable();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * A flag indicating (heuristically) whether import data are indexed.
|
|
|
|
|
|
+ * A flag indicating whether import data are indexed.
|
|
*
|
|
*
|
|
- * @return boolean whether import data are queryable(heuristically)
|
|
|
|
|
|
+ * @return boolean whether import data are queryable
|
|
*/
|
|
*/
|
|
- public boolean HeuristicIndexed() {
|
|
|
|
- return response.getHeuristicDataQueryable();
|
|
|
|
|
|
+ public boolean indexed() {
|
|
|
|
+ return response.getDataIndexed();
|
|
}
|
|
}
|
|
|
|
|
|
private String getInfo(@NonNull String key) {
|
|
private String getInfo(@NonNull String key) {
|