amogh-jahagirdar commented on code in PR #11525:
URL: https://github.com/apache/iceberg/pull/11525#discussion_r1838496080


##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkPositionDeltaWrite.java:
##########
@@ -500,33 +500,32 @@ protected PartitioningWriter<PositionDelete<InternalRow>, 
DeleteWriteResult> new
             targetFileSize,
             deleteGranularity,
             rewritableDeletes != null
-                ? new PreviousDeleteLoader(table, rewritableDeletes)
+                ? new PreviousDeleteLoader(table, rewritableDeletes, specs)
                 : path -> null /* no previous file scoped deletes */);
       }
     }
   }
 
   private static class PreviousDeleteLoader implements Function<CharSequence, 
PositionDeleteIndex> {
-    private final Map<String, DeleteFileSet> deleteFiles;
+    private final RewritableDeletes rewritableDeletes;
     private final DeleteLoader deleteLoader;
+    private final Map<Integer, PartitionSpec> specs;
 
-    PreviousDeleteLoader(Table table, Map<String, DeleteFileSet> deleteFiles) {
-      this.deleteFiles = deleteFiles;
+    PreviousDeleteLoader(
+        Table table, RewritableDeletes rewritableDeletes, Map<Integer, 
PartitionSpec> specs) {
+      this.rewritableDeletes = rewritableDeletes;
       this.deleteLoader =
           new BaseDeleteLoader(
               deleteFile ->
                   EncryptingFileIO.combine(table.io(), table.encryption())
                       .newInputFile(deleteFile));
+      this.specs = specs;
     }
 
     @Override
     public PositionDeleteIndex apply(CharSequence path) {
-      DeleteFileSet deleteFileSet = deleteFiles.get(path.toString());
-      if (deleteFileSet == null) {
-        return null;
-      }
-
-      return deleteLoader.loadPositionDeletes(deleteFileSet, path);
+      return deleteLoader.loadPositionDeletes(
+          rewritableDeletes.deletesFor(path.toString(), specs), path);

Review Comment:
   I'll go back to explicitly returning a null index in case there are no 
deletes for the given path, the internal implementation of loader takes care of 
it regardless but it isn't obvious without reading into it.



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