kennknowles commented on code in PR #33554:
URL: https://github.com/apache/beam/pull/33554#discussion_r1910661020
##########
sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/SerializableDataFile.java:
##########
@@ -199,4 +203,53 @@ DataFile createDataFile(Map<Integer, PartitionSpec>
partitionSpecs) {
}
return output;
}
+
+ @Override
+ @SuppressWarnings("EqualsHashCode")
Review Comment:
Don't suppress this. You really need to address it.
##########
sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/SerializableDataFile.java:
##########
@@ -199,4 +203,53 @@ DataFile createDataFile(Map<Integer, PartitionSpec>
partitionSpecs) {
}
return output;
}
+
+ @Override
+ @SuppressWarnings("EqualsHashCode")
+ public final boolean equals(@Nullable Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SerializableDataFile that = (SerializableDataFile) o;
+ return getPath().equals(that.getPath())
+ && getFileFormat().equals(that.getFileFormat())
+ && getRecordCount() == that.getRecordCount()
+ && getFileSizeInBytes() == that.getFileSizeInBytes()
+ && getPartitionPath().equals(that.getPartitionPath())
+ && getPartitionSpecId() == that.getPartitionSpecId()
+ && Objects.equals(getKeyMetadata(), that.getKeyMetadata())
+ && Objects.equals(getSplitOffsets(), that.getSplitOffsets())
+ && Objects.equals(getColumnSizes(), that.getColumnSizes())
+ && Objects.equals(getValueCounts(), that.getValueCounts())
+ && Objects.equals(getNullValueCounts(), that.getNullValueCounts())
+ && Objects.equals(getNanValueCounts(), that.getNanValueCounts())
+ && mapEquals(getLowerBounds(), that.getLowerBounds())
+ && mapEquals(getUpperBounds(), that.getUpperBounds());
+ }
+
+ private static boolean mapEquals(
+ @Nullable Map<Integer, byte[]> map1, @Nullable Map<Integer, byte[]>
map2) {
Review Comment:
The map isn't the issue, it is the byte[]. There may be an alternative byte
buffer data structure that would have a structural equals.
Otherwise, what you need to do for `structuralValue` is wrap any mutable
array. It is quite a pain.
##########
sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/SerializableDataFile.java:
##########
@@ -199,4 +203,53 @@ DataFile createDataFile(Map<Integer, PartitionSpec>
partitionSpecs) {
}
return output;
}
+
+ @Override
+ @SuppressWarnings("EqualsHashCode")
+ public final boolean equals(@Nullable Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SerializableDataFile that = (SerializableDataFile) o;
+ return getPath().equals(that.getPath())
Review Comment:
You are sure that autovalue `equals` doesn't handle this?
I am concerned that it is a lot of toil and error-prone to manage this list
of calls. It really should be automated by autovalue.
Is there a way to combine any auto-generated `equals` with just the slight
changes you intend?
--
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]