RussellSpitzer commented on a change in pull request #1313:
URL: https://github.com/apache/iceberg/pull/1313#discussion_r467933277



##########
File path: 
spark/src/test/java/org/apache/iceberg/actions/TestRemoveOrphanFilesAction.java
##########
@@ -569,4 +569,39 @@ public void testRemoveOrphanFilesWithHadoopCatalog() 
throws InterruptedException
         .collectAsList();
     Assert.assertEquals("Rows must match", records, actualRecords);
   }
+
+  @Test
+  public void testRemoveOrphanFilesWithExecutorParallel() {
+    Table table = TABLES.create(SCHEMA, PartitionSpec.unpartitioned(), 
Maps.newHashMap(), tableLocation);
+
+    List<ThreeColumnRecord> records = Lists.newArrayList(
+        new ThreeColumnRecord(1, "AAAAAAAAAA", "AAAA")
+    );
+
+    Dataset<Row> df = spark.createDataFrame(records, 
ThreeColumnRecord.class).coalesce(1);
+
+    df.select("c1", "c2", "c3")
+        .write()
+        .format("iceberg")
+        .mode("append")
+        .save(tableLocation);
+
+    for (int i = 0; i < 20; i++) {
+      df.write().mode("append").parquet(tableLocation + "/data");
+    }
+
+    Actions actions = Actions.forTable(table);
+
+    List<String> result = actions.removeOrphanFiles()
+        .olderThan(System.currentTimeMillis())
+        .executorParallelNum(10)
+        .execute();
+    Assert.assertEquals("Should delete only 20 files", 20, result.size());
+
+    // gets the number of tasks completed by the last stage
+    int completedTasks = spark.sparkContext().statusTracker()
+        .getStageInfo(23).get().numCompletedTasks();
+
+    Assert.assertEquals("Should executor only 10 tasks", 10, completedTasks);

Review comment:
       Message isn't clear here, "Executor should complete only 10 tasks"?




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

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