nastra commented on code in PR #8086:
URL: https://github.com/apache/iceberg/pull/8086#discussion_r1265051778


##########
spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestBranchDDL.java:
##########
@@ -289,4 +291,53 @@ private Table insertRows() throws NoSuchTableException {
     df.writeTo(tableName).append();
     return validationCatalog.loadTable(tableIdent);
   }
+
+  @Test
+  public void createOrReplaceWithNonExistingBranch() throws 
NoSuchTableException {
+    Table table = insertRows();
+    String branchName = "b1";
+    insertRows();
+    long snapshotId = table.currentSnapshot().snapshotId();
+
+    sql(
+        "ALTER TABLE %s CREATE OR REPLACE BRANCH %s AS OF VERSION %d",
+        tableName, branchName, snapshotId);
+    table.refresh();
+    
assertThat(table.refs().get(branchName).snapshotId()).isEqualTo(snapshotId);
+  }
+
+  @Test
+  public void replaceBranch() throws NoSuchTableException {

Review Comment:
   there was a test gap for branches where a pure replace and a replace on a 
non-existing branch wasn't exercised, therefore I added `replaceBranch()` / 
`replaceBranchDoesNotExist()` / `testCreateOrReplace()` (similar tests already 
exist in `TestTagDDL`)



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