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


##########
spark/v3.3/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestDelete.java:
##########
@@ -1066,6 +1068,50 @@ public void testDeleteWithMultipleSpecs() {
         sql("SELECT * FROM %s ORDER BY id", selectTarget()));
   }
 
+  @Test
+  public void testDeleteToWAPBranch() throws NoSuchTableException {
+    Assume.assumeTrue("WAP branch only works for table identifier without 
branch", branch == null);
+
+    createAndInitPartitionedTable();
+    sql(
+        "ALTER TABLE %s SET TBLPROPERTIES ('%s' = 'true')",
+        tableName, TableProperties.WRITE_AUDIT_PUBLISH_ENABLED);
+    append(new Employee(0, "hr"), new Employee(1, "hr"), new Employee(2, 
"hr"));
+
+    try {
+      spark.conf().set(SparkSessionProperties.WAP_BRANCH, "wap");
+      sql("DELETE FROM %s t WHERE id=0", tableName);
+      Assert.assertEquals(
+          "Should have expected num of rows", 2L, spark.table(tableName + 
".branch_wap").count());
+    } finally {
+      spark.conf().unset(SparkSessionProperties.WAP_BRANCH);
+    }
+  }
+
+  @Test
+  public void testDeleteToWAPBranchWithTableBranchIdentifier() throws 
NoSuchTableException {
+    Assume.assumeTrue("Test must have branch name part in table identifier", 
branch != null);
+
+    createAndInitPartitionedTable();
+    sql(
+        "ALTER TABLE %s SET TBLPROPERTIES ('%s' = 'true')",
+        tableName, TableProperties.WRITE_AUDIT_PUBLISH_ENABLED);
+    append(tableName, new Employee(0, "hr"), new Employee(1, "hr"), new 
Employee(2, "hr"));
+    createBranchIfNeeded();
+
+    try {
+      spark.conf().set(SparkSessionProperties.WAP_BRANCH, "wap");
+      Assertions.assertThatThrownBy(() -> sql("DELETE FROM %s t WHERE id=0", 
commitTarget()))
+          .isInstanceOf(ValidationException.class)
+          .hasMessage(
+              String.format(
+                  "Cannot set both branch and WAP branch, but got branch [%s] 
and WAP branch [wap]",

Review Comment:
   "Cannot write to" isntead of "Cannot set"?



##########
spark/v3.3/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestDelete.java:
##########
@@ -1066,6 +1068,50 @@ public void testDeleteWithMultipleSpecs() {
         sql("SELECT * FROM %s ORDER BY id", selectTarget()));
   }
 
+  @Test
+  public void testDeleteToWAPBranch() throws NoSuchTableException {
+    Assume.assumeTrue("WAP branch only works for table identifier without 
branch", branch == null);

Review Comment:
   I see that this is tested in the next case, so we're good.



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