Skip to content

Commit

Permalink
Don't export rows info in index params (#2190)
Browse files Browse the repository at this point in the history
Signed-off-by: Cai Zhang <[email protected]>
  • Loading branch information
xiaocai2333 authored Jul 25, 2024
1 parent 2a76769 commit 8c55e62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pymilvus/client/grpc_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down
4 changes: 4 additions & 0 deletions pymilvus/orm/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 8c55e62

Please sign in to comment.