use of com.facebook.presto.common.predicate.TupleDomainFilter in project presto by prestodb.
the class MapDirectSelectiveStreamReader method getTopLevelFilter.
private static Optional<TupleDomainFilter> getTopLevelFilter(Map<Subfield, TupleDomainFilter> filters) {
Map<Subfield, TupleDomainFilter> topLevelFilters = Maps.filterEntries(filters, entry -> entry.getKey().getPath().isEmpty());
if (topLevelFilters.isEmpty()) {
return Optional.empty();
}
checkArgument(topLevelFilters.size() == 1, "MAP column may have at most one top-level range filter");
TupleDomainFilter filter = Iterables.getOnlyElement(topLevelFilters.values());
checkArgument(filter == IS_NULL || filter == IS_NOT_NULL, "Top-level range filter on MAP column must be IS NULL or IS NOT NULL");
return Optional.of(filter);
}
use of com.facebook.presto.common.predicate.TupleDomainFilter in project presto by prestodb.
the class MapFlatSelectiveStreamReader method getTopLevelFilter.
private static Optional<TupleDomainFilter> getTopLevelFilter(Map<Subfield, TupleDomainFilter> filters) {
Map<Subfield, TupleDomainFilter> topLevelFilters = Maps.filterEntries(filters, entry -> entry.getKey().getPath().isEmpty());
if (topLevelFilters.isEmpty()) {
return Optional.empty();
}
checkArgument(topLevelFilters.size() == 1, "MAP column may have at most one top-level range filter");
TupleDomainFilter filter = Iterables.getOnlyElement(topLevelFilters.values());
checkArgument(filter == IS_NULL || filter == IS_NOT_NULL, "Top-level range filter on MAP column must be IS NULL or IS NOT NULL");
return Optional.of(filter);
}
use of com.facebook.presto.common.predicate.TupleDomainFilter in project presto by prestodb.
the class ListFilter method setupNullsFilter.
private void setupNullsFilter() {
int count = topLevelOffsets[topLevelOffsetCount - 1];
nullsAllowed = ensureCapacity(nullsAllowed, count);
nonNullsAllowed = ensureCapacity(nonNullsAllowed, count);
for (int i = 0; i < count; i++) {
long filter = elementFilters[i] & nullFilters;
if (filter > 0) {
TupleDomainFilter tupleDomainFilter = tupleDomainFilters[numberOfTrailingZeros(filter)];
nullsAllowed[i] = tupleDomainFilter == IS_NULL;
nonNullsAllowed[i] = tupleDomainFilter == IS_NOT_NULL;
} else {
nullsAllowed[i] = true;
nonNullsAllowed[i] = true;
}
}
nullsFilter.setup(nullsAllowed, nonNullsAllowed, topLevelOffsets);
}
Aggregations