Skip to content

Commit 7553bbe

Browse files
authored
[core] Optimize equals and hashCode implementation in Snapshot (#5375)
1 parent 5103f3a commit 7553bbe

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

paimon-core/src/main/java/org/apache/paimon/Snapshot.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,12 +424,16 @@ public int hashCode() {
424424
totalRecordCount,
425425
deltaRecordCount,
426426
changelogRecordCount,
427-
watermark);
427+
watermark,
428+
statistics);
428429
}
429430

430431
@Override
431432
public boolean equals(Object o) {
432-
if (!(o instanceof Snapshot)) {
433+
if (this == o) {
434+
return true;
435+
}
436+
if (o == null || getClass() != o.getClass()) {
433437
return false;
434438
}
435439
Snapshot that = (Snapshot) o;
@@ -451,7 +455,8 @@ public boolean equals(Object o) {
451455
&& Objects.equals(totalRecordCount, that.totalRecordCount)
452456
&& Objects.equals(deltaRecordCount, that.deltaRecordCount)
453457
&& Objects.equals(changelogRecordCount, that.changelogRecordCount)
454-
&& Objects.equals(watermark, that.watermark);
458+
&& Objects.equals(watermark, that.watermark)
459+
&& Objects.equals(statistics, that.statistics);
455460
}
456461

457462
/** Type of changes in this snapshot. */

0 commit comments

Comments
 (0)