Java Code Examples for io.prestosql.spi.predicate.Domain#includesNullableValue()

The following examples show how to use io.prestosql.spi.predicate.Domain#includesNullableValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MemoryPageSourceProvider.java    From presto with Apache License 2.0 5 votes vote down vote up
private boolean positionMatchesPredicate(Page page, int position, Map<Integer, Domain> domains)
{
    for (Map.Entry<Integer, Domain> entry : domains.entrySet()) {
        int channel = entry.getKey();
        Domain domain = entry.getValue();
        Object value = TypeUtils.readNativeValue(domain.getType(), page.getBlock(channel), position);
        if (!domain.includesNullableValue(value)) {
            return false;
        }
    }

    return true;
}
 
Example 2
Source File: LocalFileRecordCursor.java    From presto with Apache License 2.0 5 votes vote down vote up
private static boolean isThisServerIncluded(HostAddress address, TupleDomain<LocalFileColumnHandle> predicate, LocalFileTableHandle table)
{
    if (table.getServerAddressColumn().isEmpty()) {
        return true;
    }

    Optional<Map<LocalFileColumnHandle, Domain>> domains = predicate.getDomains();
    if (domains.isEmpty()) {
        return true;
    }

    Set<Domain> serverAddressDomain = domains.get().entrySet().stream()
            .filter(entry -> entry.getKey().getOrdinalPosition() == table.getServerAddressColumn().getAsInt())
            .map(Map.Entry::getValue)
            .collect(toSet());

    if (serverAddressDomain.isEmpty()) {
        return true;
    }

    for (Domain domain : serverAddressDomain) {
        if (domain.includesNullableValue(Slices.utf8Slice(address.toString()))) {
            return true;
        }
    }
    return false;
}
 
Example 3
Source File: HivePartitionManager.java    From presto with Apache License 2.0 5 votes vote down vote up
public static boolean partitionMatches(List<HiveColumnHandle> partitionColumns, TupleDomain<ColumnHandle> constraintSummary, HivePartition partition)
{
    if (constraintSummary.isNone()) {
        return false;
    }
    Map<ColumnHandle, Domain> domains = constraintSummary.getDomains().get();
    for (HiveColumnHandle column : partitionColumns) {
        NullableValue value = partition.getKeys().get(column);
        Domain allowedDomain = domains.get(column);
        if (allowedDomain != null && !allowedDomain.includesNullableValue(value.getValue())) {
            return false;
        }
    }
    return true;
}