Skip to content

Commit

Permalink
Do not call mergeColumnStatistics when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
arhimondr committed Nov 15, 2018
1 parent 8a143be commit c6134c4
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@
import static com.facebook.presto.orc.metadata.Stream.StreamKind.DICTIONARY_DATA;
import static com.facebook.presto.orc.metadata.Stream.StreamKind.LENGTH;
import static com.facebook.presto.orc.metadata.Stream.StreamKind.ROW_INDEX;
import static com.facebook.presto.orc.metadata.statistics.ColumnStatistics.mergeColumnStatistics;
import static com.facebook.presto.orc.stream.CheckpointInputStreamSource.createCheckpointStreamSource;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.Iterables.getOnlyElement;
import static java.lang.Math.toIntExact;
import static java.util.Objects.requireNonNull;

Expand Down Expand Up @@ -466,7 +468,14 @@ private static Map<Integer, ColumnStatistics> getRowGroupStatistics(OrcType root
for (int ordinal = 0; ordinal < rootStructType.getFieldCount(); ordinal++) {
List<ColumnStatistics> columnStatistics = groupedColumnStatistics.get(rootStructType.getFieldTypeIndex(ordinal));
if (columnStatistics != null) {
statistics.put(ordinal, ColumnStatistics.mergeColumnStatistics(columnStatistics));
if (columnStatistics.size() == 1) {
statistics.put(ordinal, getOnlyElement(columnStatistics));
}
else {
// Merge statistics from different streams
// This can happen if map is represented as struct (DWRF only)
statistics.put(ordinal, mergeColumnStatistics(columnStatistics));
}
}
}
return statistics.build();
Expand Down

0 comments on commit c6134c4

Please sign in to comment.