Skip to content

Commit

Permalink
[CLN] remove dead code in metadata proto conversion (#2083)
Browse files Browse the repository at this point in the history
## 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)?*
  • Loading branch information
HammadB authored Apr 30, 2024
1 parent b15928e commit f070188
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions chromadb/segment/impl/metadata/grpc_segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f070188

Please sign in to comment.