Fokko commented on code in PR #3060:
URL: https://github.com/apache/parquet-java/pull/3060#discussion_r1843357739
##########
parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestParquetWriter.java:
##########
@@ -524,4 +527,71 @@ private void testParquetFileNumberOfBlocks(
assertEquals(expectedNumberOfBlocks, footer.getBlocks().size());
}
}
+
+ @Test
+ public void testSizeStatisticsControl() throws Exception {
+ MessageType schema = Types.buildMessage()
+ .required(BINARY)
+ .named("string_field")
+ .required(BOOLEAN)
+ .named("boolean_field")
+ .required(INT32)
+ .named("int32_field")
+ .named("test_schema");
+
+ SimpleGroupFactory factory = new SimpleGroupFactory(schema);
+
+ // Create test data
+ Group group = factory.newGroup()
+ .append("string_field", "test")
+ .append("boolean_field", true)
+ .append("int32_field", 42);
+
+ // Test global disable
+ File file = temp.newFile();
+ temp.delete();
+ Path path = new Path(file.getAbsolutePath());
+ ParquetWriter<Group> writer = ExampleParquetWriter.builder(path)
+ .withType(schema)
+ .withSizeStatisticsEnabled(false)
+ .build();
+ writer.write(group);
+ writer.close();
+
+ ParquetFileReader reader =
ParquetFileReader.open(HadoopInputFile.fromPath(path, new Configuration()));
Review Comment:
Nit: I prefer to also use try-with-resource in the tests to give a good
example :)
--
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]