Fokko commented on code in PR #6892:
URL: https://github.com/apache/iceberg/pull/6892#discussion_r1121796610


##########
python/pyiceberg/expressions/visitors.py:
##########
@@ -485,6 +505,13 @@ def visit_less_than(self, term: BoundTerm[L], literal: 
Literal[L]) -> bool:
     def visit_less_than_or_equal(self, term: BoundTerm[L], literal: 
Literal[L]) -> bool:
         return term.eval(self.struct) <= literal.value
 
+    def visit_starts_with(self, term: BoundTerm[L], literal: Literal[L]) -> 
bool:
+        eval_res = term.eval(self.struct)
+        return eval_res is not None and 
str(eval_res).startswith(str(literal.value))

Review Comment:
   I don't think that casting it to a string is valid for when we pass in 
bytes. What do you think of:
   ```
   ➜  python git:(python_expressions) ✗ python3
   Python 3.11.2 (main, Feb 16 2023, 02:55:59) [Clang 14.0.0 
(clang-1400.0.29.202)] on darwin
   Type "help", "copyright", "credits" or "license" for more information.
   >>> str(b'1230').startswith(str(b'123'))
   False
   >>> b'123'[0:3] == b'123'
   True
   ```



-- 
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]

Reply via email to