amogh-jahagirdar commented on code in PR #7050:
URL: https://github.com/apache/iceberg/pull/7050#discussion_r1134622526
##########
spark/v3.3/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestDelete.java:
##########
@@ -1066,6 +1068,73 @@ 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"));
+
+ withSQLConf(
+ ImmutableMap.of(SparkSQLProperties.WAP_BRANCH, "wap"),
+ () -> {
+ sql("DELETE FROM %s t WHERE id=0", tableName);
+ Assert.assertEquals(
+ "Should have expected num of rows when reading table",
+ 2L,
+ spark.table(tableName).count());
+ Assert.assertEquals(
+ "Should have expected num of rows when reading WAP branch",
+ 2L,
+ spark.table(tableName + ".branch_wap").count());
+ Assert.assertEquals(
+ "Should not modify main branch", 3L, spark.table(tableName +
".branch_main").count());
+ });
+
+ withSQLConf(
+ ImmutableMap.of(SparkSQLProperties.WAP_BRANCH, "wap"),
+ () -> {
+ sql("DELETE FROM %s t WHERE id=1", tableName);
+ Assert.assertEquals(
+ "Should have expected num of rows when reading table with
multiple writes",
+ 1L,
+ spark.table(tableName).count());
+ Assert.assertEquals(
+ "Should have expected num of rows when reading WAP branch with
multiple writes",
+ 1L,
+ spark.table(tableName + ".branch_wap").count());
+ Assert.assertEquals(
+ "Should not modify main branch with multiple writes",
+ 3L,
+ spark.table(tableName + ".branch_main").count());
Review Comment:
Ah nvm, I misinterpreted, we actually do need this!
--
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]