amogh-jahagirdar commented on code in PR #9196:
URL: https://github.com/apache/iceberg/pull/9196#discussion_r1412683806


##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/procedures/FastForwardBranchProcedure.java:
##########
@@ -73,19 +71,16 @@ public StructType outputType() {
   @Override
   public InternalRow[] call(InternalRow args) {
     Identifier tableIdent = toIdentifier(args.getString(0), 
PARAMETERS[0].name());
-    String source = args.getString(1);
-    String target = args.getString(2);
+    String from = args.getString(1);
+    String to = args.getString(2);
 
     return modifyIcebergTable(
         tableIdent,
         table -> {
-          Snapshot currentSnapshot = table.snapshot(source);
-          Preconditions.checkArgument(
-              currentSnapshot != null, "Branch to fast-forward does not exist: 
%s", source);
-          table.manageSnapshots().fastForwardBranch(source, target).commit();
-          long latest = table.snapshot(source).snapshotId();
-          InternalRow outputRow =
-              newInternalRow(UTF8String.fromString(source), 
currentSnapshot.snapshotId(), latest);
+          Long before = table.snapshot(from) != null ? 
table.snapshot(from).snapshotId() : null;
+          table.manageSnapshots().fastForwardOrCreateBranch(from, to).commit();

Review Comment:
   This is a behavior change, but as mentioned in the description, I think it's 
the right behavior (and the previous behavior of failing when the from branch 
didn't exist arguably was a bug). Wonder what folks think here though. 
   
   @rakesh-das08 @nastra @Fokko @aokolnychyi @holdenk  



-- 
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

Reply via email to