ahmedabu98 commented on code in PR #34021:
URL: https://github.com/apache/beam/pull/34021#discussion_r1974778895


##########
sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/RecordWriter.java:
##########
@@ -69,7 +69,8 @@ class RecordWriter {
     }
     OutputFile outputFile;
     try (FileIO io = table.io()) {
-      outputFile = io.newOutputFile(absoluteFilename);
+      OutputFile tmpFile = io.newOutputFile(absoluteFilename);
+      outputFile = (OutputFile) table.encryption().encrypt(tmpFile);

Review Comment:
   Note that this line will actually encrypt the outputFile and wrap it in a 
[`EncryptedOutputFile`](https://github.com/apache/iceberg/blob/a50ec923f3d928f67e2a4a361c0d1162341aa084/api/src/main/java/org/apache/iceberg/encryption/EncryptedOutputFile.java#L30).
 This object holds two key pieces:
   - `.encryptingOutputFile()`: the wrapped OutputFile that is primed for 
encryption 
   - `.keyMetadata()`: the information needed to encrypt the file when writing
   
   So we should actually retrieve the wrapped output file, and pass the 
keyMetadata piece to our writers below, e.g.
   
   ```java
     .withKeyMetadata(keyMetadata)
   ```



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

Reply via email to