nastra commented on code in PR #14645:
URL: https://github.com/apache/iceberg/pull/14645#discussion_r2549989762
##########
core/src/test/java/org/apache/iceberg/puffin/TestPuffinWriter.java:
##########
@@ -86,6 +98,36 @@ public void testWriteMetricDataCompressedZstd() throws
Exception {
testWriteMetric(ZSTD, "v1/sample-metric-data-compressed-zstd.bin");
}
+ @ParameterizedTest
+ @ValueSource(booleans = {true, false})
+ public void testLengthCalculation(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];
+ 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 ? 158 : 122);
Review Comment:
```suggestion
assertThat(writer.length()).isEqualTo(isEncrypted ? 158L : 122L);
```
--
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]