wgtmac commented on code in PR #2989:
URL: https://github.com/apache/parquet-java/pull/2989#discussion_r1719458307
##########
parquet-column/src/main/java/org/apache/parquet/column/impl/ColumnValueCollector.java:
##########
@@ -36,59 +36,75 @@
class ColumnValueCollector {
private final ColumnDescriptor path;
+ private final boolean statisticsEnabled;
private BloomFilterWriter bloomFilterWriter;
private BloomFilter bloomFilter;
private Statistics<?> statistics;
private SizeStatistics.Builder sizeStatisticsBuilder;
ColumnValueCollector(ColumnDescriptor path, BloomFilterWriter
bloomFilterWriter, ParquetProperties props) {
this.path = path;
+ this.statisticsEnabled = props.getStatisticsEnabled(path);
resetPageStatistics();
initBloomFilter(bloomFilterWriter, props);
}
void resetPageStatistics() {
- this.statistics = Statistics.createStats(path.getPrimitiveType());
+ this.statistics = statisticsEnabled ?
Statistics.createStats(path.getPrimitiveType()) : null;
this.sizeStatisticsBuilder = SizeStatistics.newBuilder(
path.getPrimitiveType(), path.getMaxRepetitionLevel(),
path.getMaxDefinitionLevel());
}
void writeNull(int repetitionLevel, int definitionLevel) {
- statistics.incrementNumNulls();
+ if (statistics != null) {
Review Comment:
Can we create a `NoopStatistics` so we don't need to this check? The point
of `ColumnValueCollector` class is to avoid any condition as it is in the
critical path.
--
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]