in pyiceberg/expressions/visitors.py [0:0]
def visit_in(self, term: BoundTerm[L], literals: Set[L]) -> bool:
field_id = term.ref().field.field_id
if self._can_contain_nulls(field_id) or self._can_contain_nans(field_id):
return ROWS_MIGHT_NOT_MATCH
field = self._get_field(field_id)
if (lower_bytes := self.lower_bounds.get(field_id)) and (upper_bytes := self.upper_bounds.get(field_id)):
# similar to the implementation in eq, first check if the lower bound is in the set
lower = _from_byte_buffer(field.field_type, lower_bytes)
if lower not in literals:
return ROWS_MIGHT_NOT_MATCH
# check if the upper bound is in the set
upper = _from_byte_buffer(field.field_type, upper_bytes)
if upper not in literals:
return ROWS_MIGHT_NOT_MATCH
# finally check if the lower bound and the upper bound are equal
if lower != upper:
return ROWS_MIGHT_NOT_MATCH
# All values must be in the set if the lower bound and the upper bound are
# in the set and are equal.
return ROWS_MUST_MATCH
return ROWS_MIGHT_NOT_MATCH