openinx commented on a change in pull request #2465:
URL: https://github.com/apache/iceberg/pull/2465#discussion_r612910279



##########
File path: api/src/main/java/org/apache/iceberg/Schema.java
##########
@@ -331,6 +363,16 @@ public Schema caseInsensitiveSelect(Collection<String> 
names) {
     return internalSelect(names, false);
   }
 
+  /**
+   * Checks whether this schema is equivalent to another schema while ignoring 
the schema ID.
+   * @param anotherSchema another schema
+   * @return true if this schema is equivalent to the given schema
+   */
+  public boolean sameSchema(Schema anotherSchema) {
+    return asStruct().equals(anotherSchema.asStruct()) &&
+        identifierFieldIds().equals(anotherSchema.identifierFieldIds());

Review comment:
       Using the `Set` to check the equality should be correct,  I was thinking 
that we could use the simple `Arrays.equals(identifierFieldIds, 
anotherSchema.identifierFieldIds)`, that means the identifier field id's order 
will matter and that's not what we expected.




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to