Fokko commented on code in PR #4274:
URL: https://github.com/apache/iceberg-python/pull/4274#discussion_r4743052137
##########
pyiceberg/io/pyarrow.py:
##########
@@ -3218,6 +3218,13 @@ def _partition_value_filter(partition_field_name: str,
value: Any) -> pc.Express
return pc.field(partition_field_name).is_null()
elif isinstance(value, float) and math.isnan(value):
return pc.is_nan(pc.field(partition_field_name))
+ elif isinstance(value, float) and value == 0.0:
+ # -0.0 and 0.0 are separate partitions but compare equal, so also match
the sign (1 / -0.0 is -inf)
+ field = pc.field(partition_field_name)
+ return (field == value) & (pc.divide(pc.scalar(1.0), field) ==
math.copysign(math.inf, value))
+ # -0.0 and 0.0 are separate partitions but compare equal, so also
match the sign (1 / -0.0 is -inf)
+ field = pc.field(partition_field_name)
+ return (field == value) & (pc.divide(pc.scalar(1.0), field) ==
math.copysign(math.inf, value))
Review Comment:
```suggestion
elif isinstance(value, float) and value == 0.0:
# -0.0 and 0.0 are separate partitions but compare equal, so also
match the sign (1 / -0.0 is -inf)
field = pc.field(partition_field_name)
return (field == value) & (pc.divide(pc.scalar(1.0), field) ==
math.copysign(math.inf, value))
```
--
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]