From 8c55e628e5a44ec1d79e78ee056e486e8d8fab95 Mon Sep 17 00:00:00 2001 From: "cai.zhang" Date: Thu, 25 Jul 2024 10:47:38 +0800 Subject: [PATCH] Don't export rows info in index params (#2190) Signed-off-by: Cai Zhang --- pymilvus/client/grpc_handler.py | 9 +++++---- pymilvus/orm/collection.py | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pymilvus/client/grpc_handler.py b/pymilvus/client/grpc_handler.py index a6e33d721..fd7998305 100644 --- a/pymilvus/client/grpc_handler.py +++ b/pymilvus/client/grpc_handler.py @@ -1050,14 +1050,14 @@ def describe_index( check_status(status) if len(response.index_descriptions) == 1: info_dict = {kv.key: kv.value for kv in response.index_descriptions[0].params} - info_dict["total_rows"] = response.index_descriptions[0].total_rows - info_dict["indexed_rows"] = response.index_descriptions[0].indexed_rows - info_dict["pending_index_rows"] = response.index_descriptions[0].pending_index_rows - info_dict["state"] = response.index_descriptions[0].state info_dict["field_name"] = response.index_descriptions[0].field_name info_dict["index_name"] = response.index_descriptions[0].index_name if info_dict.get("params"): info_dict["params"] = json.loads(info_dict["params"]) + info_dict["total_rows"] = response.index_descriptions[0].total_rows + info_dict["indexed_rows"] = response.index_descriptions[0].indexed_rows + info_dict["pending_index_rows"] = response.index_descriptions[0].pending_index_rows + info_dict["state"] = common_pb2.IndexState.Name(response.index_descriptions[0].state) return info_dict raise AmbiguousIndexName(message=ExceptionsMessage.AmbiguousIndexName) @@ -1077,6 +1077,7 @@ def get_index_build_progress( "total_rows": index_desc.total_rows, "indexed_rows": index_desc.indexed_rows, "pending_index_rows": index_desc.pending_index_rows, + "state": common_pb2.IndexState.Name(index_desc.state), } raise AmbiguousIndexName(message=ExceptionsMessage.AmbiguousIndexName) diff --git a/pymilvus/orm/collection.py b/pymilvus/orm/collection.py index 15492aea3..760ddc4de 100644 --- a/pymilvus/orm/collection.py +++ b/pymilvus/orm/collection.py @@ -1314,6 +1314,10 @@ def index(self, **kwargs) -> Index: if tmp_index is not None: field_name = tmp_index.pop("field_name", None) index_name = tmp_index.pop("index_name", index_name) + tmp_index.pop("total_rows") + tmp_index.pop("indexed_rows") + tmp_index.pop("pending_index_rows") + tmp_index.pop("state") return Index(self, field_name, tmp_index, construct_only=True, index_name=index_name) raise IndexNotExistException(message=ExceptionsMessage.IndexNotExist)