public static void replaceBranch(Table table,
      AlterTableSnapshotRefSpec.ReplaceSnapshotrefSpec replaceSnapshotrefSpec) {
    String sourceBranch = replaceSnapshotrefSpec.getSourceRefName();
    ManageSnapshots manageSnapshots;
    if (replaceSnapshotrefSpec.isReplaceBySnapshot()) {
      long targetSnapshot = replaceSnapshotrefSpec.getTargetSnapshot();
      LOG.info("Replacing branch {} with snapshot {} on iceberg table {}", sourceBranch, targetSnapshot, table.name());
      manageSnapshots = table.manageSnapshots().replaceBranch(sourceBranch, targetSnapshot);
    } else {
      String targetBranch = replaceSnapshotrefSpec.getTargetBranchName();
      LOG.info("Replacing branch {} with branch {} on iceberg table {}", sourceBranch, targetBranch, table.name());
      manageSnapshots = table.manageSnapshots().replaceBranch(sourceBranch, targetBranch);
    }
    setOptionalReplaceParams(replaceSnapshotrefSpec, manageSnapshots, sourceBranch);
    manageSnapshots.commit();
  }
Create a branch on the iceberg table
@param table the iceberg table
@param createBranchSpec Get the basic parameters needed to create a branch
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergSnapshotRefExec.java