szlta commented on code in PR #14645:
URL: https://github.com/apache/iceberg/pull/14645#discussion_r2555418606


##########
core/src/test/java/org/apache/iceberg/puffin/TestPuffinWriter.java:
##########
@@ -86,6 +98,37 @@ public void testWriteMetricDataCompressedZstd() throws 
Exception {
     testWriteMetric(ZSTD, "v1/sample-metric-data-compressed-zstd.bin");
   }
 
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testFileSizeCalculation(boolean isEncrypted) throws Exception {
+    final OutputFile outputFile;
+
+    if (isEncrypted) {
+      File testFile = temp.resolve("test" + System.nanoTime()).toFile();
+      Random random = new Random();
+      byte[] key = new byte[16];
+      random.nextBytes(key);
+      byte[] aadPrefix = new byte[16];
+      random.nextBytes(aadPrefix);
+      outputFile = new AesGcmOutputFile(Files.localOutput(testFile), key, 
aadPrefix);
+    } else {
+      outputFile = new InMemoryOutputFile();
+    }
+
+    PuffinWriter writer = Puffin.write(outputFile).build();
+    writer.write(
+        new Blob(
+            "blob",
+            ImmutableList.of(1),
+            2,
+            1,
+            ByteBuffer.wrap("blob".getBytes()),
+            null,
+            ImmutableMap.of()));
+    writer.close();
+    assertThat(writer.length()).isEqualTo(isEncrypted ? 158L : 122L);

Review Comment:
   I don't think it's in the scope of this change. Sounds rather as a new IT 
test to be made that covers writing Puffin delete files and then reading it 
back (along with the respective manifest writes and reads where this fix is 
actually reflected)



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