From f070188ca7af004a82220614671c14a882254344 Mon Sep 17 00:00:00 2001 From: Hammad Bashir Date: Tue, 30 Apr 2024 09:29:21 -0700 Subject: [PATCH] [CLN] remove dead code in metadata proto conversion (#2083) ## Description of changes *Summarize the changes made by this PR.* - Improvements & Bug fixes - This code case can never happen because the direct equality case is handled already. this removes dead code and comments the logic - New functionality - ... ## Test plan *How are these changes tested?* - [ ] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Documentation Changes *Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the [docs repository](https://github.com/chroma-core/docs)?* --- .../segment/impl/metadata/grpc_segment.py | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/chromadb/segment/impl/metadata/grpc_segment.py b/chromadb/segment/impl/metadata/grpc_segment.py index 7a844a23095..35452af7482 100644 --- a/chromadb/segment/impl/metadata/grpc_segment.py +++ b/chromadb/segment/impl/metadata/grpc_segment.py @@ -247,23 +247,9 @@ def _where_to_proto(self, where: Optional[Where]) -> pb.Where: f"Expected where operand value to be a string, int, or float, got {operand}" ) else: - # Our key is a metadata field name and the value is meant - # to be compared for strict equality. - if type(operand) is str: - ssc = pb.SingleStringComparison() - ssc.value = operand - ssc.comparator = pb.GenericComparator.EQ - dc.single_string_operand.CopyFrom(ssc) - elif type(operand) is int: - sic = pb.SingleIntComparison() - sic.value = operand - sic.generic_comparator = pb.GenericComparator.EQ - dc.single_int_operand.CopyFrom(sic) - elif type(operand) is float: - sfc = pb.SingleDoubleComparison() - sfc.value = operand - sfc.generic_comparator = pb.GenericComparator.EQ - dc.single_double_operand.CopyFrom(sfc) + # This case should never happen, as we've already + # handled the case for direct comparisons. + pass response.direct_comparison.CopyFrom(dc) return response