You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2019/06/06 10:44:18 UTC

[GitHub] [incubator-iceberg] fbocse commented on a change in pull request #201: Add appendManifest to AppendFiles API.

fbocse commented on a change in pull request #201: Add appendManifest to AppendFiles API.
URL: https://github.com/apache/incubator-iceberg/pull/201#discussion_r291124004
 
 

 ##########
 File path: core/src/main/java/org/apache/iceberg/ManifestWriter.java
 ##########
 @@ -31,9 +31,50 @@
 /**
  * Writer for manifest files.
  */
-class ManifestWriter implements FileAppender<DataFile> {
+public class ManifestWriter implements FileAppender<DataFile> {
   private static final Logger LOG = LoggerFactory.getLogger(ManifestWriter.class);
 
+  static ManifestFile copyAppendManifest(ManifestReader reader, OutputFile outputFile, long snapshotId,
+                                         SnapshotSummary.Builder summaryBuilder) {
+    ManifestWriter writer = new ManifestWriter(reader.spec(), outputFile, snapshotId);
+    boolean threw = true;
+    try {
+      for (ManifestEntry entry : reader.entries()) {
+        Preconditions.checkArgument(entry.status() == ManifestEntry.Status.ADDED,
+            "Cannot append manifest: contains existing files");
+        summaryBuilder.addedFile(reader.spec(), entry.file());
 
 Review comment:
   This particular feature would come very handy for use-cases that involve manifests migration or manifest sanitization even and I was wondering if we could consider a very basic extension to the API, something that would enable us to also mangle with the `DataFile` details?
   I guess a very basic `Function<DataFile, DataFile> fileHandler` to wrap the `entry.file()` or something similar would do the trick; also it'd be very simple to provide the identity function for the default implementation.
   Wdyt?
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org