wooyeong commented on code in PR #9455:
URL: https://github.com/apache/iceberg/pull/9455#discussion_r1447417783
##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkTable.java:
##########
@@ -405,15 +407,25 @@ public boolean equals(Object other) {
return false;
}
- // use only name in order to correctly invalidate Spark cache
+ // use name and effective snapshot id to support time travel
SparkTable that = (SparkTable) other;
- return icebergTable.name().equals(that.icebergTable.name());
+ return icebergTable.name().equals(that.icebergTable.name())
+ && Objects.equals(effectiveSnapshotId(), that.effectiveSnapshotId());
}
@Override
public int hashCode() {
- // use only name in order to correctly invalidate Spark cache
- return icebergTable.name().hashCode();
+ // use name and effective snapshot id to support time travel
+ return Objects.hash(icebergTable.name(), effectiveSnapshotId());
+ }
+
+ public Long effectiveSnapshotId() {
Review Comment:
Please note the below statements, the `table`'s `currentSnapshot` is changed.
```java
assertThat(table).as("The SparkTable points to latest
snapshot").isEqualTo(firstTagTable);
assertThat(table).as("The SparkTable points to latest
snapshot").isEqualTo(secondTagTable);
```
--
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]