ajantha-bhat commented on code in PR #6575: URL: https://github.com/apache/iceberg/pull/6575#discussion_r1069013177
########## 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: It always use the latest commit from the reference. I think we also need to provide a way to time travel to a snapshot within a branch/tag? So along with existing of `FOR SYSTEM_VERSION AS OF snapshotId` we should have `FOR SYSTEM_VERSION AS OF snapshotId@refName` But whether to use '@' or some other syntax is an open point for a long time which @rdblue wanted to conclude. Nessie SQL syntax for reference: https://projectnessie.org/tools/sql/#grammar -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org