Fokko commented on code in PR #6892:
URL: https://github.com/apache/iceberg/pull/6892#discussion_r1121802482
##########
python/pyiceberg/expressions/visitors.py:
##########
@@ -678,6 +705,59 @@ def visit_less_than_or_equal(self, term: BoundTerm[L],
literal: Literal[L]) -> b
return ROWS_MIGHT_MATCH
+ def visit_starts_with(self, term: BoundTerm[L], literal: Literal[L]) ->
bool:
+ pos = term.ref().accessor.position
+ field = self.partition_fields[pos]
+ prefix = str(literal.value)
+ len_prefix = len(prefix)
+
+ if not field.lower_bound:
+ return ROWS_CANNOT_MATCH
+
+ lower = _from_byte_buffer(term.ref().field.field_type,
field.lower_bound)
+ # truncate lower bound so that its length is not greater than the
length of prefix
+ if lower and lower[:len_prefix] > prefix:
Review Comment:
```suggestion
if lower is not None and lower[:len_prefix] > prefix:
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]