You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/12/02 14:45:22 UTC

[GitHub] [iceberg] smallx commented on a diff in pull request #6305: API: Override `equals` and `hashCode` methods for primitive types

smallx commented on code in PR #6305:
URL: https://github.com/apache/iceberg/pull/6305#discussion_r1038214032


##########
api/src/main/java/org/apache/iceberg/types/Type.java:
##########
@@ -112,6 +113,23 @@ public PrimitiveType asPrimitiveType() {
     Object writeReplace() throws ObjectStreamException {
       return new PrimitiveHolder(toString());
     }
+
+    @Override
+    public boolean equals(Object o) {
+      if (this == o) {
+        return true;
+      } else if (!(o instanceof PrimitiveType)) {
+        return false;
+      }
+
+      PrimitiveType that = (PrimitiveType) o;
+      return typeId() == that.typeId();

Review Comment:
   @pvary `TimestampType`, `FixedType` and `DecimalType` have overridden `equals` and `hashCode` methods of `Object` and `PrimitiveType`.



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