kevinjqliu commented on code in PR #3503:
URL: https://github.com/apache/iceberg-python/pull/3503#discussion_r3448998093
##########
pyiceberg/expressions/visitors.py:
##########
@@ -1905,10 +1905,12 @@ def visit_starts_with(self, term: BoundTerm, literal:
LiteralValue) -> BooleanEx
return AlwaysFalse()
def visit_not_starts_with(self, term: BoundTerm, literal: LiteralValue) ->
BooleanExpression:
- if not self.visit_starts_with(term, literal):
- return AlwaysTrue()
- else:
+ starts_with_result = self.visit_starts_with(term, literal)
+ # Should return opposite of visit_starts_with
+ if isinstance(starts_with_result, AlwaysTrue):
return AlwaysFalse()
+ else:
+ return AlwaysTrue()
Review Comment:
```suggestion
return ~self.visit_starts_with(term, literal)
```
might be cleaner to rely on `AlwaysTrue`/`AlwaysFalse`'s `__invert__`
function
--
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]