Copilot commented on code in PR #3817:
URL: https://github.com/apache/iceberg-python/pull/3817#discussion_r3832483172


##########
pyiceberg/expressions/visitors.py:
##########
@@ -1880,25 +1880,29 @@ def visit_not_nan(self, term: BoundTerm) -> 
BooleanExpression:
             return self.visit_true()
 
     def visit_less_than(self, term: BoundTerm, literal: LiteralValue) -> 
BooleanExpression:
-        if term.eval(self.struct) < literal.value:
+        value = term.eval(self.struct)
+        if value is None or value < literal.value:

Review Comment:
   Returning `AlwaysTrue` for a null value violates the strict-projection 
contract: PyIceberg's row evaluator treats both `None < literal` and `None <= 
literal` as false (`visitors.py:511-517`). It also makes `DataScan.count()` 
take the `AlwaysTrue` fast path and count every row in a null identity 
partition (`table/__init__.py:2523-2525`), while a normal Arrow scan filters 
those rows out. Guard both less-than comparisons with `value is not None` so 
residual and row evaluation remain consistent.



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