huaxingao commented on code in PR #16327:
URL: https://github.com/apache/iceberg/pull/16327#discussion_r3327157858
##########
parquet/src/test/java/org/apache/iceberg/parquet/TestParquetDataWriter.java:
##########
@@ -543,4 +546,69 @@ protected int resolveColumnIndex(Void engineSchema, String
columnName) {
variantSchema.asStruct(), variantRecords.get(i),
writtenRecords.get(i));
}
}
+
+ @ParameterizedTest
+ @ValueSource(strings = {"gzip", "snappy", "zstd", "uncompressed"})
+ public void testRowGroupSizeEnforcedWhenCompressionEnabled(String codec)
throws IOException {
+ // With uncompressed tracking, row groups split at the configured target
+ DataFile dataFile = writeCompressibleRecords(codec, true);
+
+ assertThat(dataFile.recordCount()).as("Record count should
match").isEqualTo(30);
+ assertThat(dataFile.splitOffsets().size())
+ .as("Row group count should reflect enforcement of the target")
+ .isGreaterThanOrEqualTo(3);
+ }
+
+ @Test
+ public void testDefaultPathUsesCompressedSize() throws IOException {
+ // Without uncompressed tracking, compressed bytes never hit the target
+ DataFile dataFile = writeCompressibleRecords("snappy", false);
+
+ assertThat(dataFile.splitOffsets().size())
+ .as("Default path should use compressed size (single row group due to
compression)")
+ .isEqualTo(1);
Review Comment:
nit: asserting exactly 1 row group here might be flaky. It only passes if
the data compresses below the 2 MB target, and random integers may not compress
that well. Maybe comparing the two counts instead (e.g. assert the default
count is less than the tracked count) rather than hard-coding 1.
--
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]