pvary commented on code in PR #15652:
URL: https://github.com/apache/iceberg/pull/15652#discussion_r2945906978
##########
core/src/test/java/org/apache/iceberg/TestManifestWriterVersions.java:
##########
@@ -313,6 +317,48 @@ public void testV3ManifestRewriteWithInheritance() throws
IOException {
checkRewrittenEntry(readManifest(manifest3), 0L, FileContent.DATA,
FIRST_ROW_ID);
}
+ @ParameterizedTest
+ @FieldSource("org.apache.iceberg.TestHelpers#ALL_VERSIONS")
+ public void testDefaultManifestCompression(int formatVersion) throws
IOException {
+ File manifestFile = temp.resolve("default-v" + formatVersion +
".avro").toFile();
+ OutputFile outputFile = Files.localOutput(manifestFile);
+
+ ManifestWriter<DataFile> writer =
+ ManifestFiles.write(formatVersion, SPEC, outputFile, SNAPSHOT_ID);
+ try {
+ writer.add(DATA_FILE);
+ } finally {
+ writer.close();
+ }
+
+ assertThat(readAvroCodec(manifestFile)).isEqualTo("deflate");
+ }
+
+ @ParameterizedTest
+ @FieldSource("org.apache.iceberg.TestHelpers#ALL_VERSIONS")
+ public void testCustomManifestCompression(int formatVersion) throws
IOException {
+ Map<String, String> props =
ImmutableMap.of(TableProperties.AVRO_COMPRESSION, "snappy");
+ File manifestFile = temp.resolve("snappy-v" + formatVersion +
".avro").toFile();
+ OutputFile outputFile = Files.localOutput(manifestFile);
+
+ ManifestWriter<DataFile> writer =
+ ManifestFiles.write(formatVersion, SPEC, outputFile, SNAPSHOT_ID,
props);
+ try {
+ writer.add(DATA_FILE);
+ } finally {
+ writer.close();
+ }
+
+ assertThat(readAvroCodec(manifestFile)).isEqualTo("snappy");
+ }
+
+ private static String readAvroCodec(File file) throws IOException {
Review Comment:
Maybe move it to some util like `AvroTestHelpers`? This is not public ATM,
so it is a bit questionable 😄
--
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]