jinyangli34 commented on code in PR #11258: URL: https://github.com/apache/iceberg/pull/11258#discussion_r1811494439
########## parquet/src/test/java/org/apache/iceberg/parquet/TestParquet.java: ########## @@ -219,6 +222,52 @@ public void testTwoLevelList() throws IOException { assertThat(recordRead.get("topbytes")).isEqualTo(expectedBinary); } + @Test + public void testParquetRowGroupSize() throws IOException { + // verify parquet row group size should be close to configured size + int recordCount = 100000; + int columnCount = 50; + + List<Types.NestedField> columns = + IntStream.rangeClosed(1, columnCount) + .mapToObj(i -> optional(i, "stringCol" + i, Types.StringType.get())) + .collect(ImmutableList.toImmutableList()); + Schema schema = new Schema(columns); + + File file = createTempFile(temp); + + List<GenericData.Record> records = Lists.newArrayListWithCapacity(recordCount); + org.apache.avro.Schema avroSchema = AvroSchemaUtil.convert(schema.asStruct()); + for (int i = 1; i <= recordCount; i++) { + GenericData.Record record = new GenericData.Record(avroSchema); + for (Types.NestedField column : columns) { + String value = column.name().repeat(10) + i; + record.put(column.name(), value); + } + + records.add(record); + } + + long actualSize = + write( + file, + schema, + ImmutableMap.of("write.parquet.row-group-size-bytes", "1048576"), + ParquetAvroWriter::buildWriter, + records.toArray(new GenericData.Record[] {})); + + try (ParquetFileReader reader = ParquetFileReader.open(ParquetIO.file(localInput(file)))) { + ParquetMetadata footer = reader.getFooter(); + for (int i = 1; i < footer.getBlocks().size() - 1; i++) { Review Comment: the test skips first row group. The first row group is expected to be not accurate in size. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org