stevenzwu commented on code in PR #7685:
URL: https://github.com/apache/iceberg/pull/7685#discussion_r1212522237


##########
core/src/main/java/org/apache/iceberg/io/RollingFileWriter.java:
##########
@@ -109,7 +109,7 @@ protected void openCurrentWriter() {
   }
 
   private EncryptedOutputFile newFile() {
-    if (partition == null) {
+    if (spec.isUnpartitioned() || partition == null) {

Review Comment:
   this check needs to be added to other writers, like `FanoutWriter`, 
`ClusteredWriter`. They all have the same pattern. 
   ```
       return partition == null
           ? fileFactory.newOutputFile()
           : fileFactory.newOutputFile(spec, partition);
     }
   ```
   
   Originally I was wondering if this check should be done in the method below 
of `OutputFileFactory` class. But I see it is not appropriate, as the Java doc 
clearly indicates that this method should be used for partitioned writes. Hence 
caller needs to separate out unpartitioned vs partitioned writes.
   ```
     /** Generates an {@link EncryptedOutputFile} for partitioned writes in a 
given spec. */
     public EncryptedOutputFile newOutputFile(PartitionSpec spec, StructLike 
partition) 
   ```



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