nastra commented on code in PR #14351:
URL: https://github.com/apache/iceberg/pull/14351#discussion_r2502652406


##########
core/src/main/java/org/apache/iceberg/RewriteTablePathUtil.java:
##########
@@ -524,6 +516,55 @@ private static DeleteFile newEqualityDeleteEntry(
         .build();
   }
 
+  private static DeleteFile newPositionDeleteEntry(
+      DeleteFile file, PartitionSpec spec, String sourcePrefix, String 
targetPrefix) {
+    String path = file.location();
+    Preconditions.checkArgument(
+        path.startsWith(sourcePrefix),
+        "Expected delete file %s to start with prefix: %s",
+        path,
+        sourcePrefix);
+
+    FileMetadata.Builder builder =
+        FileMetadata.deleteFileBuilder(spec)
+            .copy(file)
+            .withPath(newPath(path, sourcePrefix, targetPrefix))
+            .withMetrics(ContentFileUtil.replacePathBounds(file, sourcePrefix, 
targetPrefix));
+
+    // Update referencedDataFile for DV files
+    String newReferencedDataFile = replaceReferencedDataFile(file, 
sourcePrefix, targetPrefix);
+    if (newReferencedDataFile != null) {
+      builder.withReferencedDataFile(newReferencedDataFile);
+    }
+
+    return builder.build();
+  }
+
+  /**
+   * Replace the referenced data file path for a DV (Deletion Vector) file.
+   *
+   * <p>For DV files, returns the updated path with the target prefix. For 
non-DV files or files
+   * without a referenced data file, returns null.
+   *
+   * @param deleteFile delete file to check
+   * @param sourcePrefix source prefix that will be replaced
+   * @param targetPrefix target prefix that will replace it
+   * @return updated referenced data file path, or null if not applicable
+   */
+  private static String replaceReferencedDataFile(

Review Comment:
   ```suggestion
     private static String rewriteReferencedDataFilePathForDV(
   ```



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