pallevam commented on code in PR #18551:
URL: https://github.com/apache/iceberg/pull/18551#discussion_r4599357140


##########
spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/actions/DeleteOrphanFilesSparkAction.java:
##########
@@ -466,6 +467,15 @@ private Dataset<String> listedFileDS() {
     }
   }
 
+  private JavaRDD<String> matchingFilesRDD(List<String> matchingFiles) {
+    int numPartitions =
+        Math.max(
+            1,
+            (matchingFiles.size() + MAX_LISTED_FILES_PER_PARTITION - 1)
+                / MAX_LISTED_FILES_PER_PARTITION);

Review Comment:
   @Baunsgaard
   Thanks for the review, all three are addressed:
   
   Switched to IntMath.divide(..., RoundingMode.CEILING) like the other 
actions, so the calculation no longer overflows.
   Moved the calculation into a @VisibleForTesting helper, 
listedFilePartitions, with tests for small listings, larger listings, and 
Integer.MAX_VALUE. The overflow test fails with the previous calculation.
   Applied the fix to Spark 3.5, 4.0 and 4.1 as well.



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