zinking commented on code in PR #8797:
URL: https://github.com/apache/iceberg/pull/8797#discussion_r1354511567


##########
spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteDataFilesProcedure.java:
##########
@@ -87,6 +89,53 @@ public void testRewriteDataFilesInEmptyTable() {
     assertEquals("Procedure output must match", ImmutableList.of(row(0, 0, 0L, 
0)), output);
   }
 
+  @Test
+  public void testRewriteWriteOnBranch() throws Exception {
+    createPartitionTable();
+    // create 5 files for each partition (c2 = 'foo' and c2 = 'bar')
+    insertData(10);
+    Table table = Spark3Util.loadIcebergTable(spark, tableName);
+    String branch = "op_audit";
+    table.manageSnapshots().createBranch(branch).commit();
+    table.refresh();
+    spark.sql(
+        String.format("ALTER TABLE %s SET TBLPROPERTIES 
('write.wap.enabled'='true')", tableName));
+    spark.sql(String.format("SET spark.wap.branch = %s", branch));
+    long lastId = table.currentSnapshot().snapshotId();
+    List<Object[]> output =
+        sql("CALL %s.system.rewrite_data_files(table => '%s')", catalogName, 
tableIdent);
+    table.refresh();
+    assertThat(table.currentSnapshot().snapshotId())
+        .as("rewrite should happen on branch")
+        .isEqualTo(lastId);
+  }
+
+  @Test
+  public void testRewriteReadFromBranch() throws Exception {

Review Comment:
   not really, I started to think rewrite could read from other branch and then 
write here. that's where the two functions come from. but now they are testing 
same thing.



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to