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


##########
core/src/main/java/org/apache/iceberg/RewriteTablePathUtil.java:
##########
@@ -251,38 +251,113 @@ private static List<Snapshot> updatePathInSnapshots(
   /**
    * Rewrite a manifest list representing a snapshot, replacing path 
references.
    *
+   * <p>Every entry keeps its source {@code manifest_length}, which does not 
match the rewritten
+   * manifest when the target prefix differs in length from the source. 
Callers that rewrite to a
+   * different-length prefix should use {@link #rewriteManifestList(Snapshot, 
FileIO, TableMetadata,
+   * List, Set, String, String, String, String, Map)} and pass the measured 
lengths.
+   */
+  public static RewriteResult<ManifestFile> rewriteManifestList(
+      Snapshot snapshot,
+      FileIO io,
+      TableMetadata tableMetadata,
+      Set<String> manifestsToRewrite,
+      String sourcePrefix,
+      String targetPrefix,
+      String stagingDir,
+      String outputPath) {
+    // no lengths are known to this overload, so every entry keeping its 
source length is expected
+    // and is not reported
+    return writeManifestList(
+        snapshot,
+        io,
+        tableMetadata,
+        manifestsInSnapshot(snapshot, io, sourcePrefix),
+        manifestsToRewrite,
+        sourcePrefix,
+        targetPrefix,
+        stagingDir,
+        outputPath,
+        ImmutableMap.of());
+  }
+
+  /**
+   * Rewrite a manifest list representing a snapshot, replacing path 
references.
+   *
+   * <p>Each entry's {@code manifest_length} is taken from {@code 
rewrittenManifestLengths}, because
+   * replacing the path prefix changes the byte length of the rewritten 
manifest.
+   *
+   * <p>Known gap: an entry whose manifest is absent from the map keeps its 
source length, which

Review Comment:
   I'm not sure this additional java doc is very helpful. It's pretty deep in 
the API (an actual user will probably never get here.) We would want to keep 
this note if we actually wanted it in the RewriteTablePath API and not in this 
utility class. You can tell this is in the wrong spot because it's referring to 
"incremental runs" which don't actually exist in this utility class.



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