jqin61 commented on code in PR #555:
URL: https://github.com/apache/iceberg-python/pull/555#discussion_r1548068306


##########
pyiceberg/typedef.py:
##########
@@ -199,3 +199,7 @@ def __repr__(self) -> str:
     def record_fields(self) -> List[str]:
         """Return values of all the fields of the Record class except those 
specified in skip_fields."""
         return [self.__getattribute__(v) if hasattr(self, v) else None for v 
in self._position_to_field_name]
+
+    def __hash__(self) -> int:
+        """Return hash value of the Record class."""
+        return hash(str(self))

Review Comment:
   I think since `__repr_` is defined, the str() might still work? I tested:
   ```
       r1 = Record(1,2)
       r2 = Record(x=1, y="string value")
       print("----")
       print(str(r1), hash(str(r1)))
       print(str(r2), hash(str(r2)))
   ```
   
   prints:
   ```
   Record[field1=1, field2=2] -7504199255027864703
   Record[x=1, y='string value'] -4897332691101137012
   ```



-- 
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-unsubscr...@iceberg.apache.org

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


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

Reply via email to