private static boolean refExistsAsBranch(Table table, String branchName) {
    SnapshotRef branchRef = table.refs().get(branchName);
    if (branchRef != null) {
      if (branchRef.isBranch()) {
        return true;
      } else {
        throw new IllegalArgumentException(
            "Cannot complete replace branch operation on " + branchName + ", as it exists as Tag");
      }
    }
    return false;
  }
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