RussellSpitzer commented on code in PR #4759:
URL: https://github.com/apache/iceberg/pull/4759#discussion_r902934322


##########
core/src/test/java/org/apache/iceberg/actions/TestSortStrategy.java:
##########
@@ -120,23 +114,51 @@ public void testSelectAll() {
   }
 
   @Test
-  public void testUseSizeOptions() {
+  public void testMisSizedRatioThreshold() {
     List<FileScanTask> expected = ImmutableList.<FileScanTask>builder()
-        .addAll(tasksForSortOrder(table.sortOrder().orderId(), 498, 551))
+        .addAll(tasksForSortOrder(table.sortOrder().orderId(), 400, 500, 520, 
590, 620))
         .build();
 
-    List<FileScanTask> fileScanTasks = ImmutableList.<FileScanTask>builder()
-        .addAll(expected)
-        .addAll(tasksForSortOrder(table.sortOrder().orderId(), 500, 500))
+    // Note that the actual mis-sized ratio of the above file is 3/5 = 0.6
+    RewriteStrategy strategy = defaultSort().options(ImmutableMap.of(
+        SortStrategy.MIS_SIZED_RATIO_THRESHOLD, "0.59",
+        SortStrategy.MIN_FILE_SIZE_BYTES, Long.toString(450 * MB),
+        SortStrategy.MAX_FILE_SIZE_BYTES, Long.toString(550 * MB)));
+    List<FileScanTask> actual = 
ImmutableList.copyOf(strategy.selectFilesToRewrite(expected));
+    Assert.assertEquals("Should mark all files for rewrite",
+        expected, actual);
+  }
+
+  @Test
+  public void testSortednessScoreThreshold() {
+    List<FileScanTask> expected = ImmutableList.<FileScanTask>builder()
+        .addAll(tasksForSortOrder(table.sortOrder().orderId(), 500, 500, 510, 
495))
         .build();
 
+    // Note that the sortedness score of existing data files of the table is 
0.0
     RewriteStrategy strategy = defaultSort().options(ImmutableMap.of(
+        SortStrategy.SORTEDNESS_SCORE_THRESHOLD, "0.01"));

Review Comment:
   We also need some tests in TestDataRewriteAction performing a full end to 
end test of 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]

Reply via email to