private static OrcPredicate getPredicate(TupleDomain<RaptorColumnHandle> effectivePredicate, Map<Long, Integer> indexMap) { ImmutableList.Builder<ColumnReference<RaptorColumnHandle>> columns = ImmutableList.builder(); for (RaptorColumnHandle column : effectivePredicate.getDomains().get().keySet()) { Integer index = indexMap.get(column.getColumnId()); if (index != null) { columns.add(new ColumnReference<>(column, index, column.getColumnType())); } } return new TupleDomainOrcPredicate<>(effectivePredicate, columns.build(), false); }
@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; }
Type type = typeManager.getType(column.getTypeSignature()); includedColumns.put(column.getHiveColumnIndex(), type); columnReferences.add(new ColumnReference<>(column, column.getHiveColumnIndex(), type));
.add(new ColumnReference<>(COLUMN_0, 0, BIGINT)) .add(new ColumnReference<>(COLUMN_1, 1, BIGINT)) .build();
.add(new ColumnReference<>(COLUMN_0, 0, BIGINT)) .add(new ColumnReference<>(COLUMN_1, 1, BIGINT)) .build();
private boolean columnOverlaps(ColumnReference<C> columnReference, Domain predicateDomain, long numberOfRows, ColumnStatistics columnStatistics) Domain stripeDomain = getDomain(columnReference.getType(), numberOfRows, columnStatistics); if (!stripeDomain.overlaps(predicateDomain)) {
private boolean columnOverlaps(ColumnReference<C> columnReference, Domain predicateDomain, long numberOfRows, ColumnStatistics columnStatistics) Domain stripeDomain = getDomain(columnReference.getType(), numberOfRows, columnStatistics); if (!stripeDomain.overlaps(predicateDomain)) {
@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; }