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 2021/07/26 03:01:24 UTC

[GitHub] [iceberg] jun-he commented on a change in pull request #2858: Core: Support multiple specs in OutputFileFactory

jun-he commented on a change in pull request #2858:
URL: https://github.com/apache/iceberg/pull/2858#discussion_r676260942



##########
File path: core/src/main/java/org/apache/iceberg/io/OutputFileFactory.java
##########
@@ -95,25 +100,71 @@ public OutputFileFactory(PartitionSpec spec, FileFormat format, LocationProvider
     this.operationId = operationId;
   }
 
+  public static Builder builderFor(Table table, FileFormat format, int partitionId, long taskId) {
+    return new Builder(table, format, partitionId, taskId);
+  }
+
   private String generateFilename() {
     return format.addExtension(
         String.format("%05d-%d-%s-%05d", partitionId, taskId, operationId, fileCount.incrementAndGet()));
   }
 
   /**
-   * Generates EncryptedOutputFile for UnpartitionedWriter.
+   * Generates an {@link EncryptedOutputFile} for unpartitioned writes.
    */
   public EncryptedOutputFile newOutputFile() {
     OutputFile file = io.newOutputFile(locations.newDataLocation(generateFilename()));
     return encryptionManager.encrypt(file);
   }
 
   /**
-   * Generates EncryptedOutputFile for PartitionedWriter.
+   * Generates an {@link EncryptedOutputFile} for partitioned writes in the default spec.
    */
   public EncryptedOutputFile newOutputFile(StructLike partition) {
+    return newOutputFile(defaultSpec, partition);
+  }
+
+  /**
+   * Generates an {@link EncryptedOutputFile} for partitioned writes in a given spec.
+   */
+  public EncryptedOutputFile newOutputFile(PartitionSpec spec, StructLike partition) {

Review comment:
       nit: wondering if there are tests covering this method and also the scenario writing to multiple specs in a single transaction?




-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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