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


##########
spark/v3.3/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestMerge.java:
##########
@@ -2448,6 +2450,65 @@ public void testMergeNonExistingBranch() {
         .hasMessage("Cannot use branch (does not exist): test");
   }
 
+  @Test
+  public void testMergeToWAPBranch() {
+    Assume.assumeTrue("WAP branch only works for table identifier without 
branch", branch == null);
+
+    createAndInitTable("id INT", "{\"id\": -1}");
+    sql(
+        "ALTER TABLE %s SET TBLPROPERTIES ('%s' = 'true')",
+        tableName, TableProperties.WRITE_AUDIT_PUBLISH_ENABLED);
+    spark.range(0, 5).coalesce(1).createOrReplaceTempView("source");
+    ImmutableList<Object[]> expectedRows =
+        ImmutableList.of(row(-1), row(0), row(1), row(2), row(3), row(4));
+
+    try {
+      spark.conf().set(SparkSessionProperties.WAP_BRANCH, "wap");
+      sql(
+          "MERGE INTO %s t USING source s ON t.id = s.id "
+              + "WHEN MATCHED THEN UPDATE SET *"
+              + "WHEN NOT MATCHED THEN INSERT *",
+          tableName);
+      assertEquals(
+          "Should correctly merge to WAP branch",
+          expectedRows,
+          sql("SELECT * FROM %s.branch_wap ORDER BY id", tableName));

Review Comment:
   Same general comments as above. It would be nice to validate both main and 
the "wap" branch.



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