rdblue commented on code in PR #6965:
URL: https://github.com/apache/iceberg/pull/6965#discussion_r1125765095


##########
spark/v3.3/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestDelete.java:
##########
@@ -276,69 +280,72 @@ public void testDeleteNonExistingRecords() {
     assertEquals(
         "Should have expected rows",
         ImmutableList.of(row(1, "hr"), row(2, "hardware"), row(null, "hr")),
-        sql("SELECT * FROM %s ORDER BY id ASC NULLS LAST", tableName));
+        sql("SELECT * FROM %s ORDER BY id ASC NULLS LAST", selectTarget()));
   }
 
   @Test
   public void testDeleteWithoutCondition() {
     createAndInitPartitionedTable();
 
-    sql("INSERT INTO TABLE %s VALUES (1, 'hr')", tableName);
-    sql("INSERT INTO TABLE %s VALUES (2, 'hardware')", tableName);
-    sql("INSERT INTO TABLE %s VALUES (null, 'hr')", tableName);
+    sql("INSERT INTO TABLE %s VALUES (1, 'hr')", queryTarget());
+    sql("INSERT INTO TABLE %s VALUES (2, 'hardware')", queryTarget());
+    sql("INSERT INTO TABLE %s VALUES (null, 'hr')", queryTarget());
 
-    sql("DELETE FROM %s", tableName);
+    sql("DELETE FROM %s", queryTarget());
 
     Table table = validationCatalog.loadTable(tableIdent);
     Assert.assertEquals("Should have 4 snapshots", 4, 
Iterables.size(table.snapshots()));
 
     // should be a delete instead of an overwrite as it is done through a 
metadata operation
-    Snapshot currentSnapshot = table.currentSnapshot();
+    Snapshot currentSnapshot = SnapshotUtil.latestSnapshot(table, branch);
     validateDelete(currentSnapshot, "2", "3");
 
     assertEquals(
-        "Should have expected rows", ImmutableList.of(), sql("SELECT * FROM 
%s", tableName));
+        "Should have expected rows", ImmutableList.of(), sql("SELECT * FROM 
%s", queryTarget()));
   }
 
   @Test
   public void testDeleteUsingMetadataWithComplexCondition() {
+    Assume.assumeTrue("test".equals(branch));

Review Comment:
   This fails for me locally, so I think you may have meant to use 
`Assume.assumeFalse`?
   
   The failure is inside `validateDelete(currentSnapshot, "2", "2")`:
   
   ```
   Operation must match expected:<[delete]> but was:<[append]>
   Expected :delete
   Actual   :append
   ```
   
   From debugging, it looks like this is catching a bug. The "test" ref points 
to the snapshot of the last insert and the "main" ref points to the `delete` 
snapshot.
   



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