ajantha-bhat commented on code in PR #6575:
URL: https://github.com/apache/iceberg/pull/6575#discussion_r1069026706
##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java:
##########
@@ -159,7 +160,15 @@ public Table loadTable(Identifier ident, String version)
throws NoSuchTableExcep
sparkTable.snapshotId() == null,
"Cannot do time-travel based on both table identifier and AS OF");
- return sparkTable.copyWithSnapshotId(Long.parseLong(version));
+ try {
+ return sparkTable.copyWithSnapshotId(Long.parseLong(version));
+ } catch (NumberFormatException e) {
+ SnapshotRef ref = sparkTable.table().refs().get(version);
+ ValidationException.check(
+ ref != null,
+ "Cannot find matching snapshot ID or reference name for version "
+ version);
+ return sparkTable.copyWithSnapshotId(ref.snapshotId());
Review Comment:
Never mind.
After thinking a bit more about it and reviewing #6573, As the snapshot log
contains all the snapshots from all the branches/tags. If we want to use any
particular snapshot, we can directly use snapshot-id without specifying
branch/tag information. So, no need of `snapshotId@refName` syntax
--
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]