ajantha-bhat commented on code in PR #8854: URL: https://github.com/apache/iceberg/pull/8854#discussion_r1362035790
########## spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestFastForwardBranchProcedure.java: ########## @@ -188,4 +188,38 @@ public void testInvalidFastForwardBranchCases() { .isInstanceOf(IllegalArgumentException.class) .hasMessage("Cannot handle an empty identifier for argument table"); } + + @Test + public void testFastForwardNonMain() { + sql("CREATE TABLE %s (id int NOT NULL, data string) USING iceberg", tableName); + sql("INSERT INTO TABLE %s VALUES (1, 'a')", tableName); + Table table = validationCatalog.loadTable(tableIdent); + table.refresh(); + + String branch1 = "branch1"; + sql("ALTER TABLE %s CREATE BRANCH %s", tableName, branch1); + String tableNameWithBranch = String.format("%s.branch_%s", tableName, branch1); Review Comment: nit: tableNameWithBranch -> tableNameWithBranch1 ? ########## spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/procedures/FastForwardBranchProcedure.java: ########## @@ -77,9 +77,9 @@ public InternalRow[] call(InternalRow args) { return modifyIcebergTable( tableIdent, table -> { - long currentRef = table.currentSnapshot().snapshotId(); + long currentRef = table.snapshot(source).snapshotId(); table.manageSnapshots().fastForwardBranch(source, target).commit(); Review Comment: I too got confused today when I checked replace branch API vs this procedure variables. Source and target is reversed. The procedure's named arguments of 'branch' and 'to' is proper. It is like fast forward branch x to y. Only thing is these internal variables in this procedure is reversed. I think we can rename it in this PR. `ManageSnapshots.replaceBranch` and `ManageSnapshots.fastForwardBranch` seems to have a correct naming IMO -- 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