vrozov commented on a change in pull request #1406: DRILL-6641: Fix
columnValueCounts in ParquetGroupScanStatistics when ParquetGroupScan has
RowGroupInfo without column statistics
URL: https://github.com/apache/drill/pull/1406#discussion_r205933181
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetGroupScanStatistics.java
##########
@@ -88,19 +88,14 @@ public void collect(List<RowGroupInfo> rowGroupInfos,
ParquetTableMetadataBase p
for (ColumnMetadata column : rowGroup.getColumns()) {
SchemaPath schemaPath = SchemaPath.getCompoundPath(column.getName());
Long previousCount = columnValueCounts.get(schemaPath);
- if (previousCount != null) {
- if (previousCount != GroupScan.NO_COLUMN_STATS &&
column.isNumNullsSet()) {
- Long newCount = rowCount - column.getNulls();
- columnValueCounts.put(schemaPath,
columnValueCounts.get(schemaPath) + newCount);
- }
+ previousCount = previousCount == null ? 0 : previousCount;
Review comment:
@vvysotskyi I mentioned not only boxing/unboxing but also hash lookup. In
any case, I have a better proposal to use `MutableLong` or `AtomicLong`:
```
final MutableLong emptyCount = new MutableLong();
MutableLong count = columnValueCounts.putIfAbsent(schemaPath,
emptyCount);
if (count == null) {
count = emptyCount;
}
if (count.longValue() != GroupScan.NO_COLUMN_STATS &&
!column.isNumNullsSet()) {
count.add(rowCount - column.getNulls());
} else {
count.setValue(GroupScan.NO_COLUMN_STATS);
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services