You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/08/10 07:07:21 UTC

[GitHub] [iceberg] zhangdove commented on a change in pull request #1313: Move RemoveOrphanFilesAction run in Driver to Excutor

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



##########
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();

Review comment:
       Is there a better way to get the last stage ID?




----------------------------------------------------------------
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:
users@infra.apache.org



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