@Override public boolean matches(long numberOfRows, Map<Integer, ColumnStatistics> statisticsByColumnIndex) { Optional<Map<C, Domain>> optionalEffectivePredicateDomains = effectivePredicate.getDomains(); if (!optionalEffectivePredicateDomains.isPresent()) { // effective predicate is none, so skip this section return false; } Map<C, Domain> effectivePredicateDomains = optionalEffectivePredicateDomains.get(); for (ColumnReference<C> columnReference : columnReferences) { Domain predicateDomain = effectivePredicateDomains.get(columnReference.getColumn()); if (predicateDomain == null) { // no predicate on this column, so we can't exclude this section continue; } ColumnStatistics columnStatistics = statisticsByColumnIndex.get(columnReference.getOrdinal()); if (columnStatistics == null) { // no statistics for this column, so we can't exclude this section continue; } if (!columnOverlaps(columnReference, predicateDomain, numberOfRows, columnStatistics)) { return false; } } // this section was not excluded return true; }
@Override public boolean matches(long numberOfRows, Map<Integer, ColumnStatistics> statisticsByColumnIndex) { Optional<Map<C, Domain>> optionalEffectivePredicateDomains = effectivePredicate.getDomains(); if (!optionalEffectivePredicateDomains.isPresent()) { // effective predicate is none, so skip this section return false; } Map<C, Domain> effectivePredicateDomains = optionalEffectivePredicateDomains.get(); for (ColumnReference<C> columnReference : columnReferences) { Domain predicateDomain = effectivePredicateDomains.get(columnReference.getColumn()); if (predicateDomain == null) { // no predicate on this column, so we can't exclude this section continue; } ColumnStatistics columnStatistics = statisticsByColumnIndex.get(columnReference.getOrdinal()); if (columnStatistics == null) { // no statistics for this column, so we can't exclude this section continue; } if (!columnOverlaps(columnReference, predicateDomain, numberOfRows, columnStatistics)) { return false; } } // this section was not excluded return true; }
@Override public boolean matches(long numberOfRows, Map<Integer, ColumnStatistics> statisticsByColumnIndex) { ImmutableMap.Builder<C, Domain> domains = ImmutableMap.builder(); for (ColumnReference<C> columnReference : columnReferences) { ColumnStatistics columnStatistics = statisticsByColumnIndex.get(columnReference.getOrdinal()); Domain domain; if (columnStatistics == null) { // no stats for column domain = Domain.all(columnReference.getType()); } else { domain = getDomain(columnReference.getType(), numberOfRows, columnStatistics); } domains.put(columnReference.getColumn(), domain); } TupleDomain<C> stripeDomain = TupleDomain.withColumnDomains(domains.build()); return effectivePredicate.overlaps(stripeDomain); }