Skip to content

Commit

Permalink
Convert Guava functional calls with Java streams
Browse files Browse the repository at this point in the history
  • Loading branch information
dain committed Mar 13, 2019
1 parent ca1d730 commit d6faf5d
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/
package io.prestosql.orc;

import com.google.common.collect.Iterables;
import com.google.common.collect.Ordering;
import io.airlift.slice.Slice;
import io.airlift.slice.Slices;
Expand All @@ -33,9 +32,6 @@
import java.util.Map;
import java.util.Objects;

import static com.google.common.base.Predicates.equalTo;
import static com.google.common.base.Predicates.notNull;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Lists.newArrayList;
import static io.prestosql.spi.type.BigintType.BIGINT;
import static io.prestosql.spi.type.BooleanType.BOOLEAN;
Expand Down Expand Up @@ -182,7 +178,7 @@ private void assertChunkStats(List<T> chunk, ColumnStatistics columnStatistics)
protected boolean chunkMatchesStats(List<T> chunk, ColumnStatistics columnStatistics)
{
// verify non null count
if (columnStatistics.getNumberOfValues() != Iterables.size(filter(chunk, notNull()))) {
if (columnStatistics.getNumberOfValues() != chunk.stream().filter(Objects::nonNull).count()) {
return false;
}

Expand Down Expand Up @@ -213,7 +209,7 @@ protected boolean chunkMatchesStats(List<Boolean> chunk, ColumnStatistics column

// statistics can be missing for any reason
if (columnStatistics.getBooleanStatistics() != null) {
if (columnStatistics.getBooleanStatistics().getTrueValueCount() != Iterables.size(filter(chunk, equalTo(Boolean.TRUE)))) {
if (columnStatistics.getBooleanStatistics().getTrueValueCount() != chunk.stream().filter(Boolean.TRUE::equals).count()) {
return false;
}
}
Expand Down

0 comments on commit d6faf5d

Please sign in to comment.