aiborodin commented on code in PR #14092:
URL: https://github.com/apache/iceberg/pull/14092#discussion_r2381010732
##########
core/src/main/java/org/apache/iceberg/io/WriteResult.java:
##########
@@ -134,4 +137,35 @@ public WriteResult build() {
return new WriteResult(dataFiles, deleteFiles, referencedDataFiles,
rewrittenDeleteFiles);
}
}
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("dataFiles", dataFiles)
+ .add("deleteFiles", deleteFiles)
+ .add("referencedDataFiles", referencedDataFiles)
+ .add("rewrittenDeleteFiles", rewrittenDeleteFiles)
+ .toString();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null || getClass() != other.getClass()) {
+ return false;
+ }
+ WriteResult that = (WriteResult) other;
+ return Objects.deepEquals(dataFiles, that.dataFiles)
+ && Objects.deepEquals(deleteFiles, that.deleteFiles)
+ && Objects.deepEquals(referencedDataFiles, that.referencedDataFiles)
+ && Objects.deepEquals(rewrittenDeleteFiles, that.rewrittenDeleteFiles);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ Arrays.hashCode(dataFiles),
+ Arrays.hashCode(deleteFiles),
+ Arrays.hashCode(referencedDataFiles),
+ Arrays.hashCode(rewrittenDeleteFiles));
+ }
Review Comment:
@pvary I am happy to extract the equals/hashCode into a separate PR and use
manual decomposition of properties of WriteResult and Data/DeleteFiles in tests
in this PR if you prefer. Although I still believe it should be totally fine to
add these methods to simplify the code.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]