namratha2403 commented on code in PR #4926:
URL: https://github.com/apache/iceberg/pull/4926#discussion_r890640358


##########
core/src/main/java/org/apache/iceberg/SnapshotProducer.java:
##########
@@ -298,11 +306,11 @@ public void commit() {
             TableMetadata.Builder update = TableMetadata.buildFrom(base);
             if (base.snapshot(newSnapshot.snapshotId()) != null) {
               // this is a rollback operation
-              update.setBranchSnapshot(newSnapshot.snapshotId(), 
SnapshotRef.MAIN_BRANCH);
+              update.setBranchSnapshot(newSnapshot.snapshotId(), branch);
             } else if (stageOnly) {
               update.addSnapshot(newSnapshot);
             } else {
-              update.setBranchSnapshot(newSnapshot, SnapshotRef.MAIN_BRANCH);
+              update.setBranchSnapshot(newSnapshot.snapshotId(), branch);

Review Comment:
   @rdblue I agree with this. Do mean having a method like following in current 
PR?
   
   `@Override
     public ThisT toBranch(String branch){
       throw new UnsupportedOperationException("Performing operations on a 
branch is currently not supported");
     }`
     
    And having the following method in next PR?
    
    `  @Override
     public ThisT toBranch(String branch){
       this.branchToUpdate = branch;
       return self();
     }`
     
     That would mean for this PR 
   
   `update.setBranchSnapshot(newSnapshot.snapshotId(), branch);`
   
   is not required ?



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

Reply via email to