Browse Source

Remove unused code

jianghua 4 years ago
parent
commit
1065f8922b

+ 0 - 28
src/main/java/io/milvus/client/ConnectFailedException.java

@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package io.milvus.client;
-
-/** Thrown when client failed to connect to server */
-public class ConnectFailedException extends Exception {
-
-  public ConnectFailedException(String message) {
-    super(message);
-  }
-}

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

@@ -22,7 +22,6 @@ package io.milvus.client;
 import io.grpc.ManagedChannelBuilder;
 
 import javax.annotation.Nonnull;
-import java.util.Objects;
 import java.util.concurrent.TimeUnit;
 
 /** Contains parameters for connecting to Milvus server */

+ 0 - 68
src/main/java/io/milvus/client/FieldBuilder.java

@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package io.milvus.client;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.json.JSONObject;
-
-/** Contains Field Parameter Builder */
-public class FieldBuilder {
-  private Map<String, Object> fields;
-
-  /** Initialize required field information: field name and data type */
-  public FieldBuilder(String fieldName, DataType fieldType) {
-    this.fields = new HashMap<>();
-    this.fields.put("field", fieldName);
-    this.fields.put("type", fieldType);
-  }
-
-  /**
-   * Add key-value pair to <code>fields</code>.
-   *
-   * @param key The param key
-   * @param value The param value
-   * @return <code>FieldBuilder</code>
-   */
-  public FieldBuilder param(String key, Object value) {
-    if (!fields.containsKey("params")) {
-      fields.put("params", new JSONObject().put(key, value));
-    } else {
-      ((JSONObject) fields.get("params")).put(key, value);
-    }
-    return this;
-  }
-
-  /**
-   * Add values to fields. Used for insert operation. This should be a list of object whose type
-   * corresponds to relative field DataType.
-   *
-   * @param value The value
-   * @return <code>FieldBuilder</code>
-   */
-  public FieldBuilder values(Object value) {
-    this.fields.put("values", value);
-    return this;
-  }
-
-  public Map<String, Object> build() {
-    return this.fields;
-  }
-}

+ 0 - 63
src/main/java/io/milvus/client/GetCollectionInfoResponse.java

@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package io.milvus.client;
-
-import javax.annotation.Nullable;
-import java.util.Optional;
-
-/**
- * Contains the returned <code>response</code> and <code>collectionMapping</code> for <code>
- * getCollectionInfo</code>
- */
-public class GetCollectionInfoResponse {
-  private final Response response;
-  private final CollectionMapping collectionMapping;
-
-  GetCollectionInfoResponse(Response response, @Nullable CollectionMapping collectionMapping) {
-    this.response = response;
-    this.collectionMapping = collectionMapping;
-  }
-
-  /**
-   * @return an <code>Optional</code> object which may or may not contain a <code>CollectionMapping
-   *     </code> object
-   * @see Optional
-   */
-  public Optional<CollectionMapping> getCollectionMapping() {
-    return Optional.ofNullable(collectionMapping);
-  }
-
-  public Response getResponse() {
-    return response;
-  }
-
-  /** @return <code>true</code> if the response status equals SUCCESS */
-  public boolean ok() {
-    return response.ok();
-  }
-
-  @Override
-  public String toString() {
-    return String.format(
-        "GetCollectionInfoResponse {%s, %s}",
-        response.toString(),
-        collectionMapping == null ? "Collection mapping = None" : collectionMapping.toString());
-  }
-}

+ 0 - 36
src/main/java/io/milvus/client/GetEntityByIDResponse.java

@@ -1,36 +0,0 @@
-package io.milvus.client;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Contains the returned <code>response</code>, valid ids within query and a <code>List</code> of
- * fields map for <code>getEntityByID</code>.
- */
-public class GetEntityByIDResponse {
-  private final Response response;
-  private List<Map<String, Object>> fieldsMap;
-
-  GetEntityByIDResponse(
-      Response response, List<Map<String, Object>> fieldsMap) {
-    this.response = response;
-    this.fieldsMap = fieldsMap;
-  }
-
-  /**
-   * @return A <code>List</code> of map with fields information. The list order corresponds
-   * to query IDs. Each <code>Map</code> maps field names to records in a row.
-   * The record object can be one of int, long, float, double, List<Float> or List<Byte>
-   * depending on the field's <code>DataType</code> you specified.
-   */
-  public List<Map<String, Object>> getFieldsMap() { return fieldsMap; }
-
-  public Response getResponse() {
-    return response;
-  }
-
-  /** @return <code>true</code> if the response status equals SUCCESS */
-  public boolean ok() {
-    return response.ok();
-  }
-}

+ 0 - 54
src/main/java/io/milvus/client/HasPartitionResponse.java

@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package io.milvus.client;
-
-/**
- * Contains the returned <code>response</code> and <code>hasPartition</code> for <code>
- * hasPartition</code>
- */
-public class HasPartitionResponse {
-    private final Response response;
-    private final boolean hasPartition;
-
-    HasPartitionResponse(Response response, boolean hasPartition) {
-        this.response = response;
-        this.hasPartition = hasPartition;
-    }
-
-    /** @return <code>true</code> if the partition is present */
-    public boolean hasPartition() {
-        return hasPartition;
-    }
-
-    public Response getResponse() {
-        return response;
-    }
-
-    /** @return <code>true</code> if the response status equals SUCCESS */
-    public boolean ok() {
-        return response.ok();
-    }
-
-    @Override
-    public String toString() {
-        return String.format(
-                "HasPartitionResponse {%s, has partition = %s}", response.toString(), hasPartition);
-    }
-}

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

@@ -21,7 +21,6 @@ package io.milvus.client;
 
 import io.milvus.grpc.IndexParam;
 import io.milvus.grpc.KeyValuePair;
-import org.json.JSONObject;
 
 import javax.annotation.Nonnull;
 import java.util.List;

+ 0 - 54
src/main/java/io/milvus/client/InsertResponse.java

@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package io.milvus.client;
-
-import java.util.List;
-
-/**
- * Contains the returned <code>response</code> and <code>entityIds</code> for <code>insert</code>
- */
-public class InsertResponse {
-  private final Response response;
-  private final List<Long> entityIds;
-
-  InsertResponse(Response response, List<Long> entityIds) {
-    this.response = response;
-    this.entityIds = entityIds;
-  }
-
-  public List<Long> getEntityIds() {
-    return entityIds;
-  }
-
-  public Response getResponse() {
-    return response;
-  }
-
-  /** @return <code>true</code> if the response status equals SUCCESS */
-  public boolean ok() {
-    return response.ok();
-  }
-
-  @Override
-  public String toString() {
-    return String.format(
-        "InsertResponse {%s, returned %d entity ids}", response.toString(), this.entityIds.size());
-  }
-}

+ 0 - 19
src/main/java/io/milvus/client/JsonBuilder.java

@@ -19,7 +19,6 @@
 
 package io.milvus.client;
 
-import javax.annotation.Nonnull;
 import org.json.JSONObject;
 
 /** Contains Json Parameter Builder */
@@ -44,24 +43,6 @@ public class JsonBuilder {
     return this;
   }
 
-  /**
-   * Add key-value pair to "params" in paramsInJson. Used by index.
-   *
-   * @param key The param key
-   * @param value The param value
-   * @return <code>JsonBuilder</code>
-   */
-  public JsonBuilder indexParam(String key, Object value) {
-    JSONObject jsonObject = new JSONObject(this.paramsInJson);
-    if (!jsonObject.has("params")) {
-      jsonObject.put("params", new JSONObject().put(key, value));
-    } else {
-      ((JSONObject) jsonObject.get("params")).put(key, value);
-    }
-    this.paramsInJson = jsonObject.toString();
-    return this;
-  }
-
   public String build() {
     return this.paramsInJson;
   }

+ 0 - 56
src/main/java/io/milvus/client/ListCollectionsResponse.java

@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package io.milvus.client;
-
-import java.util.List;
-
-/**
- * Contains the returned <code>response</code> and <code>collectionNames</code> for <code>
- * listCollections</code>
- */
-public class ListCollectionsResponse {
-  private final Response response;
-  private final List<String> collectionNames;
-
-  ListCollectionsResponse(Response response, List<String> collectionNames) {
-    this.response = response;
-    this.collectionNames = collectionNames;
-  }
-
-  public List<String> getCollectionNames() {
-    return collectionNames;
-  }
-
-  public Response getResponse() {
-    return response;
-  }
-
-  /** @return <code>true</code> if the response status equals SUCCESS */
-  public boolean ok() {
-    return response.ok();
-  }
-
-  @Override
-  public String toString() {
-    return String.format(
-        "ListCollectionsResponse {%s, collection names = %s}",
-        response, collectionNames.toString());
-  }
-}

+ 0 - 30
src/main/java/io/milvus/client/ListIDInSegmentResponse.java

@@ -1,30 +0,0 @@
-package io.milvus.client;
-
-import java.util.List;
-
-/**
- * Contains the returned <code>response</code> and a <code>List</code> of ids present in a segment
- * for <code>listIDInSegment</code>.
- */
-public class ListIDInSegmentResponse {
-  private final Response response;
-  private final List<Long> ids;
-
-  ListIDInSegmentResponse(Response response, List<Long> ids) {
-    this.response = response;
-    this.ids = ids;
-  }
-
-  public List<Long> getIds() {
-    return ids;
-  }
-
-  public Response getResponse() {
-    return response;
-  }
-
-  /** @return <code>true</code> if the response status equals SUCCESS */
-  public boolean ok() {
-    return response.ok();
-  }
-}

+ 0 - 57
src/main/java/io/milvus/client/ListPartitionsResponse.java

@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package io.milvus.client;
-
-import java.util.List;
-
-/**
- * Contains the returned <code>response</code> and <code>partitionList</code> for <code>
- * listPartitions</code>
- */
-public class ListPartitionsResponse {
-  private final Response response;
-  private final List<String> partitionList;
-
-  ListPartitionsResponse(Response response, List<String> partitionList) {
-    this.response = response;
-    this.partitionList = partitionList;
-  }
-
-  /** @return a <code>List</code> of partition tags. */
-  public List<String> getPartitionList() {
-    return partitionList;
-  }
-
-  public Response getResponse() {
-    return response;
-  }
-
-  /** @return <code>true</code> if the response status equals SUCCESS */
-  public boolean ok() {
-    return response.ok();
-  }
-
-  @Override
-  public String toString() {
-    return String.format(
-        "ListPartitionsResponse {%s, partition names = %s}",
-        response, partitionList.toString());
-  }
-}

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

@@ -351,9 +351,7 @@ public interface MilvusClient {
    *
    * @param collectionName collection to get entities from
    * @param ids a <code>List</code> of entity ids
-   * @return <code>GetEntityByIDResponse</code>
-   * @see GetEntityByIDResponse
-   * @see Response
+   * @return a list of property maps.
    */
   List<Map<String, Object>> getEntityByID(String collectionName, List<Long> ids);
 

+ 0 - 61
src/main/java/io/milvus/client/MilvusGrpcClient.java

@@ -19,7 +19,6 @@
 
 package io.milvus.client;
 
-import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -30,14 +29,12 @@ import io.grpc.ClientInterceptor;
 import io.grpc.ManagedChannel;
 import io.grpc.ManagedChannelBuilder;
 import io.grpc.MethodDescriptor;
-import io.grpc.StatusRuntimeException;
 import io.milvus.client.exception.ClientSideMilvusException;
 import io.milvus.client.exception.MilvusException;
 import io.milvus.client.exception.ServerSideMilvusException;
 import io.milvus.client.exception.UnsupportedServerVersion;
 import io.milvus.grpc.*;
 import org.apache.commons.lang3.ArrayUtils;
-import org.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -51,7 +48,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
-import java.util.function.Function;
 import java.util.function.Supplier;
 import java.util.stream.Collectors;
 
@@ -106,18 +102,6 @@ public class MilvusGrpcClient extends AbstractMilvusGrpcClient {
     return futureStub;
   }
 
-  @Override
-  protected boolean maybeAvailable() {
-    switch (channel.getState(false)) {
-      case IDLE:
-      case CONNECTING:
-      case READY:
-        return true;
-      default:
-        return false;
-    }
-  }
-
   @Override
   public void close(long maxWaitSeconds) {
     channel.shutdown();
@@ -154,11 +138,6 @@ public class MilvusGrpcClient extends AbstractMilvusGrpcClient {
         return futureStub;
       }
 
-      @Override
-      protected boolean maybeAvailable() {
-        return MilvusGrpcClient.this.maybeAvailable();
-      }
-
       @Override
       public void close(long maxWaitSeconds) {
         MilvusGrpcClient.this.close(maxWaitSeconds);
@@ -187,14 +166,9 @@ public class MilvusGrpcClient extends AbstractMilvusGrpcClient {
 }
 
 abstract class AbstractMilvusGrpcClient implements MilvusClient {
-  private static final Logger logger = LoggerFactory.getLogger(AbstractMilvusGrpcClient.class);
-
   protected abstract MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub();
-
   protected abstract MilvusServiceGrpc.MilvusServiceFutureStub futureStub();
 
-  protected abstract boolean maybeAvailable();
-
   private void translateExceptions(Runnable body) {
     translateExceptions(() -> {
       body.run();
@@ -317,13 +291,11 @@ abstract class AbstractMilvusGrpcClient implements MilvusClient {
   }
 
   @Override
-  @SuppressWarnings("unchecked")
   public List<Long> insert(@Nonnull InsertParam insertParam) {
     return translateExceptions(() -> Futures.getUnchecked(insertAsync(insertParam)));
   }
 
   @Override
-  @SuppressWarnings("unchecked")
   public ListenableFuture<List<Long>> insertAsync(@Nonnull InsertParam insertParam) {
     return translateExceptions(() -> {
       io.milvus.grpc.InsertParam request = insertParam.grpc();
@@ -546,16 +518,6 @@ abstract class AbstractMilvusGrpcClient implements MilvusClient {
   }
 
   ///////////////////// Util Functions/////////////////////
-  Function<Status, Response> transformStatusToResponseFunc =
-      status -> {
-        if (status.getErrorCode() == ErrorCode.SUCCESS) {
-          return new Response(Response.Status.SUCCESS);
-        } else {
-          return new Response(
-              Response.Status.valueOf(status.getErrorCodeValue()), status.getReason());
-        }
-      };
-
   private SearchResult buildSearchResponse(QueryResult topKQueryResult) {
     final int numQueries = (int) topKQueryResult.getRowNum();
     final int topK = numQueries == 0 ? 0 : topKQueryResult.getDistancesCount() / numQueries;
@@ -615,27 +577,4 @@ abstract class AbstractMilvusGrpcClient implements MilvusClient {
 
     return new SearchResult(numQueries, topK, resultIdsList, resultDistancesList, resultFieldsMap);
   }
-
-  private String kvListToString(List<KeyValuePair> kv) {
-    JSONObject jsonObject = new JSONObject();
-    for (KeyValuePair keyValuePair : kv) {
-      if (keyValuePair.getValue().equals("null")) continue;
-      jsonObject.put(keyValuePair.getKey(), keyValuePair.getValue());
-    }
-    return jsonObject.toString();
-  }
-
-  ///////////////////// Log Functions//////////////////////
-
-  private void logInfo(String msg, Object... params) {
-    logger.info(msg, params);
-  }
-
-  private void logWarning(String msg, Object... params) {
-    logger.warn(msg, params);
-  }
-
-  private void logError(String msg, Object... params) {
-    logger.error(msg, params);
-  }
 }

+ 0 - 115
src/main/java/io/milvus/client/Response.java

@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package io.milvus.client;
-
-import java.util.Arrays;
-import java.util.Optional;
-
-/**
- * Represents response of a client call. Contains a <code>status</code> and a <code>message</code>
- */
-public class Response {
-
-  private final Status status;
-  private final String message;
-
-  public Response(Status status, String message) {
-    this.status = status;
-    this.message = message;
-  }
-
-  public Response(Status status) {
-    this.status = status;
-    if (status == Status.CLIENT_NOT_CONNECTED) {
-      this.message = "You are not connected to Milvus server";
-    } else {
-      this.message = "Success!";
-    }
-  }
-
-  public Status getStatus() {
-    return status;
-  }
-
-  public String getMessage() {
-    return message;
-  }
-
-  /** @return <code>true</code> if status equals SUCCESS */
-  public boolean ok() {
-    return status == Status.SUCCESS;
-  }
-
-  @Override
-  public String toString() {
-    return String.format("Response {code = %s, message = \"%s\"}", status.name(), this.message);
-  }
-
-  /** Represents server and client side status code */
-  public enum Status {
-    // Server side error
-    SUCCESS(0),
-    UNEXPECTED_ERROR(1),
-    CONNECT_FAILED(2),
-    PERMISSION_DENIED(3),
-    COLLECTION_NOT_EXISTS(4),
-    ILLEGAL_ARGUMENT(5),
-    ILLEGAL_DIMENSION(7),
-    ILLEGAL_INDEX_TYPE(8),
-    ILLEGAL_COLLECTION_NAME(9),
-    ILLEGAL_TOPK(10),
-    ILLEGAL_ROWRECORD(11),
-    ILLEGAL_VECTOR_ID(12),
-    ILLEGAL_SEARCH_RESULT(13),
-    FILE_NOT_FOUND(14),
-    META_FAILED(15),
-    CACHE_FAILED(16),
-    CANNOT_CREATE_FOLDER(17),
-    CANNOT_CREATE_FILE(18),
-    CANNOT_DELETE_FOLDER(19),
-    CANNOT_DELETE_FILE(20),
-    BUILD_INDEX_ERROR(21),
-    ILLEGAL_NLIST(22),
-    ILLEGAL_METRIC_TYPE(23),
-    OUT_OF_MEMORY(24),
-
-    // Client side error
-    RPC_ERROR(-1),
-    CLIENT_NOT_CONNECTED(-2),
-    UNKNOWN(-3),
-    VERSION_MISMATCH(-4);
-
-    private final int code;
-
-    Status(int code) {
-      this.code = code;
-    }
-
-    public static Status valueOf(int val) {
-      Optional<Status> search =
-          Arrays.stream(values()).filter(status -> status.code == val).findFirst();
-      return search.orElse(UNKNOWN);
-    }
-
-    public int getCode() {
-      return code;
-    }
-  }
-}

+ 1 - 4
src/test/java/io/milvus/client/MilvusGrpcClientTest.java

@@ -19,7 +19,6 @@
 
 package io.milvus.client;
 
-import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import io.grpc.NameResolverProvider;
 import io.grpc.NameResolverRegistry;
@@ -344,7 +343,6 @@ class MilvusClientTest {
   }
 
   @org.junit.jupiter.api.Test
-  @SuppressWarnings("unchecked")
   void partitionTest() {
     final String tag1 = "tag1";
     client.createPartition(randomCollectionName, tag1);
@@ -697,7 +695,6 @@ class MilvusClientTest {
   }
 
   @org.junit.jupiter.api.Test
-  @SuppressWarnings("unchecked")
   void getEntityByIDBinary() {
     final int binaryDimension = 64;
 
@@ -779,7 +776,7 @@ class MilvusClientTest {
   }
 
   @org.junit.jupiter.api.Test
-  void flushAsync() throws ExecutionException, InterruptedException {
+  void flushAsync() {
     client.flushAsync(randomCollectionName);
   }