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 2021/01/30 21:53:56 UTC

[GitHub] [iceberg] rdblue commented on a change in pull request #2096: Core: add schema id and schemas to table metadata

rdblue commented on a change in pull request #2096:
URL: https://github.com/apache/iceberg/pull/2096#discussion_r567323955



##########
File path: api/src/main/java/org/apache/iceberg/Schema.java
##########
@@ -328,6 +329,24 @@ private Schema internalSelect(Collection<String> names, boolean caseSensitive) {
     return TypeUtil.select(this, selected);
   }
 
+  @Override
+  public boolean equals(Object other) {
+    if (this == other) {
+      return true;
+    } else if (!(other instanceof Schema)) {
+      return false;
+    }
+
+    Schema that = (Schema) other;
+    return struct.equals(that.struct) &&
+        Objects.equals(aliasToId, that.aliasToId);
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(struct, aliasToId);
+  }

Review comment:
       Why add `equals` and `hashCode` to `Schema`? The reason why we didn't already have this implemented is that you can compare the type using `schema.asStruct().equals(...)`. And we don't want to define whether two schemas are "equal" based on the aliases because the same schema can have different original aliases.




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

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