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


##########
core/src/test/java/org/apache/iceberg/TestRowDelta.java:
##########
@@ -77,6 +77,64 @@ public void testAddDeleteFile() {
         statuses(Status.ADDED, Status.ADDED));
   }
 
+  @Test
+  public void testAddDeleteFileBranch() {
+    table
+        .newRowDelta()
+        .addRows(FILE_A)
+        .addDeletes(FILE_A_DELETES)
+        .addDeletes(FILE_B_DELETES)
+        .toBranch("testBranch")
+        .commit();
+
+    SnapshotRef branch = table.refs().get("testBranch");
+    Assert.assertNotNull(branch);
+    Snapshot snap = table.snapshot(branch.snapshotId());
+    Assert.assertEquals("Commit should produce sequence number 1", 1, 
snap.sequenceNumber());
+    Assert.assertEquals(
+        "Last sequence number should be 1", 1, 
table.ops().current().lastSequenceNumber());
+    Assert.assertEquals(
+        "Delta commit should use operation 'overwrite'",
+        DataOperations.OVERWRITE,
+        snap.operation());
+
+    Assert.assertEquals("Should produce 1 data manifest", 1, 
snap.dataManifests(table.io()).size());
+    validateManifest(
+        snap.dataManifests(table.io()).get(0),
+        seqs(1),
+        ids(snap.snapshotId()),
+        files(FILE_A),
+        statuses(Status.ADDED));
+
+    Assert.assertEquals(
+        "Should produce 1 delete manifest", 1, 
snap.deleteManifests(table.io()).size());
+    validateDeleteManifest(
+        snap.deleteManifests(table.io()).get(0),
+        seqs(1, 1),
+        ids(snap.snapshotId(), snap.snapshotId()),
+        files(FILE_A_DELETES, FILE_B_DELETES),
+        statuses(Status.ADDED, Status.ADDED));
+  }
+
+  @Test
+  public void testValidateFailsWhenStartingSnapshotNotAncestorOfCommit() {
+    
table.newRowDelta().addRows(FILE_A).addDeletes(FILE_A_DELETES).toBranch("testBranch").commit();
+    long testSnapshot = table.refs().get("testBranch").snapshotId();
+    
table.newRowDelta().addRows(FILE_A).addDeletes(FILE_A_DELETES).toBranch("otherBranch").commit();
+
+    AssertHelpers.assertThrows(
+        "Should fail to commit when validating from non-ancestor snapshot",
+        ValidationException.class,
+        "Cannot commit, missing data files",

Review Comment:
   need to fix the message



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