rambleraptor commented on code in PR #3503:
URL: https://github.com/apache/iceberg-python/pull/3503#discussion_r3416162417
##########
pyiceberg/expressions/visitors.py:
##########
@@ -1905,10 +1905,11 @@ 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)
+ if isinstance(starts_with_result, AlwaysTrue):
Review Comment:
```suggestion
# Should return opposite of visit_starts_with
if isinstance(starts_with_result, AlwaysTrue):
```
This took me a few seconds to understand why we're returning the opposite. I
think this helps with readability a lot.
##########
tests/expressions/test_residual_evaluator.py:
##########
@@ -249,3 +249,16 @@ def test_not_in_timestamp() -> None:
ts_day += 3 # type: ignore
residual = res_eval.residual_for(Record(ts_day))
assert residual == AlwaysTrue()
+
+
+def test_not_starts_with() -> None:
Review Comment:
While you're here, can you right the same test for `StartsWith`? It would be
good to have a future sanity check that we're not making the same mistake twice.
--
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]