aokolnychyi commented on code in PR #9251:
URL: https://github.com/apache/iceberg/pull/9251#discussion_r1425376250


##########
core/src/main/java/org/apache/iceberg/DeleteFileIndex.java:
##########
@@ -474,68 +421,52 @@ private Collection<DeleteFile> loadDeleteFiles() {
     DeleteFileIndex build() {
       Iterable<DeleteFile> files = deleteFiles != null ? filterDeleteFiles() : 
loadDeleteFiles();
 
-      boolean useColumnStatsFiltering = false;
+      EqualityDeletes globalDeletes = new EqualityDeletes();
+      PartitionMap<EqualityDeletes> eqDeletesByPartition = 
PartitionMap.create(specsById);
+      PartitionMap<PositionDeletes> posDeletesByPartition = 
PartitionMap.create(specsById);
+      CharSequenceMap<PositionDeletes> posDeletesByPath = 
CharSequenceMap.create();
 
-      // build a map from (specId, partition) to delete file entries
-      Map<Integer, StructLikeWrapper> wrappersBySpecId = Maps.newHashMap();
-      ListMultimap<Pair<Integer, StructLikeWrapper>, IndexedDeleteFile> 
deleteFilesByPartition =
-          Multimaps.newListMultimap(Maps.newHashMap(), Lists::newArrayList);
       for (DeleteFile file : files) {
-        int specId = file.specId();
-        PartitionSpec spec = specsById.get(specId);
-        StructLikeWrapper wrapper =
-            wrappersBySpecId
-                .computeIfAbsent(specId, id -> 
StructLikeWrapper.forType(spec.partitionType()))
-                .copyFor(file.partition());
-        IndexedDeleteFile indexedFile = new IndexedDeleteFile(spec, file);
-        deleteFilesByPartition.put(Pair.of(specId, wrapper), indexedFile);
-
-        if (!useColumnStatsFiltering) {
-          useColumnStatsFiltering = indexedFile.hasLowerAndUpperBounds();
+        CharSequence path = ContentFileUtil.referencedDataFile(file);
+        if (path != null) {
+          PositionDeletes deletes = posDeletesByPath.computeIfAbsent(path, 
PositionDeletes::new);
+          deletes.add(file);
+        } else {
+          int specId = file.specId();
+          PartitionSpec spec = specsById.get(specId);
+          StructLike partition = file.partition();
+          if (file.content() == FileContent.POSITION_DELETES) {
+            PositionDeletes deletes = fetchPosDeletes(posDeletesByPartition, 
specId, partition);

Review Comment:
   I restructured this part quite a bit. Let me know if it is any better.



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