From 8a239355e30c41acc3f7f3d12a2c4b85fc1d7f2e Mon Sep 17 00:00:00 2001 From: BossZou <40255591+BossZou@users.noreply.github.com> Date: Fri, 14 Aug 2020 15:37:01 +0800 Subject: [PATCH] [skip ci] Fix mishards query result reduce error (#3256) Signed-off-by: yinghao.zou --- shards/mishards/service_handler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shards/mishards/service_handler.py b/shards/mishards/service_handler.py index e64f1f1f..6b9422e8 100644 --- a/shards/mishards/service_handler.py +++ b/shards/mishards/service_handler.py @@ -27,7 +27,8 @@ class ServiceHandler(milvus_pb2_grpc.MilvusServiceServicer): self.max_workers = max_workers def _reduce(self, source_ids, ids, source_diss, diss, k, reverse): - sort_f = lambda x, y: x >= y if reverse else lambda x, y: x <= y + sort_f = (lambda x, y: x >= y) if reverse else (lambda x, y: x <= y) + if sort_f(source_diss[k - 1], diss[0]): return source_ids, source_diss if sort_f(diss[k - 1], source_diss[0]): -- GitLab