All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.milvus.response.GetCollStatResponseWrapper Maven / Gradle / Ivy

Go to download

Java SDK for Milvus, a distributed high-performance vector search engine. update grpc to 1.42.1 update protobuf to 3.19.1

There is a newer version: 2.2.2.1
Show newest version
package io.milvus.response;

import io.milvus.grpc.GetCollectionStatisticsResponse;
import io.milvus.grpc.KeyValuePair;
import io.milvus.param.Constant;
import lombok.NonNull;

import java.util.List;

/**
 * Utility class to wrap response of getCollectionStatistics interface.
 */
public class GetCollStatResponseWrapper {
    private final GetCollectionStatisticsResponse stat;

    public GetCollStatResponseWrapper(@NonNull GetCollectionStatisticsResponse stat) {
        this.stat = stat;
    }

    /**
     * Gets the row count of a field.
     * Throw {@link NumberFormatException} if the row count is not a number.
     *
     * @return int dimension of the vector field
     */
    public long getRowCount() throws NumberFormatException {
        List stats = stat.getStatsList();
        for (KeyValuePair kv : stats) {
            if (kv.getKey().compareTo(Constant.ROW_COUNT) == 0) {
                return Long.parseLong(kv.getValue());
            }
        }

        return 0;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy