You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "Fokko (via GitHub)" <gi...@apache.org> on 2023/02/02 01:11:01 UTC

[GitHub] [iceberg] Fokko commented on a diff in pull request #6714: Python: Filter on Datafile metrics

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


##########
python/pyiceberg/expressions/literals.py:
##########
@@ -328,6 +328,9 @@ def __le__(self, other: Any) -> bool:
     def __ge__(self, other: Any) -> bool:
         return self._value32 >= other
 
+    def __hash__(self) -> int:
+        return hash(self.value)

Review Comment:
   They are identical:
   ```
   ➜  python git:(fd-filter-on-statistics) python3
   Python 3.10.9 (main, Dec 15 2022, 17:11:09) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import struct
   >>> 
   >>> hash(struct.unpack("<f", struct.pack("<f", 22))[0])
   22
   >>> hash(22)
   22
   >>> struct.unpack("<f", struct.pack("<f", 22))[0]
   22.0
   >>> 22
   22
   >>> 22.0
   22.0
   ```
   I'm not sure why we have the `_value32` there anyway. Looks like we're just packing and unpacking the 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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org