Search in sources :

Example 1 with Marker

use of io.prestosql.spi.predicate.Marker in project hetu-core by openlookeng.

the class TupleDomainFilterUtils method bigintRangeToFilter.

private static TupleDomainFilter bigintRangeToFilter(Range range, boolean nullAllowed) {
    Marker low = range.getLow();
    Marker high = range.getHigh();
    long lowerLong = low.isLowerUnbounded() ? Long.MIN_VALUE : (long) low.getValue();
    long upperLong = high.isUpperUnbounded() ? Long.MAX_VALUE : (long) high.getValue();
    if (!high.isUpperUnbounded() && high.getBound() == Marker.Bound.BELOW) {
        --upperLong;
    }
    if (!low.isLowerUnbounded() && low.getBound() == Marker.Bound.ABOVE) {
        ++lowerLong;
    }
    if (upperLong < lowerLong) {
        return ALWAYS_FALSE;
    }
    return TupleDomainFilter.BigintRange.of(lowerLong, upperLong, nullAllowed);
}
Also used : Marker(io.prestosql.spi.predicate.Marker)

Example 2 with Marker

use of io.prestosql.spi.predicate.Marker in project hetu-core by openlookeng.

the class TupleDomainFilterUtils method doubleRangeToFilter.

private static TupleDomainFilter doubleRangeToFilter(Range range, boolean nullAllowed) {
    Marker low = range.getLow();
    Marker high = range.getHigh();
    double lowerDouble = low.isLowerUnbounded() ? Double.MIN_VALUE : (double) low.getValue();
    double upperDouble = high.isUpperUnbounded() ? Double.MAX_VALUE : (double) high.getValue();
    if (!low.isLowerUnbounded() && Double.isNaN(lowerDouble)) {
        return ALWAYS_FALSE;
    }
    if (!high.isUpperUnbounded() && Double.isNaN(upperDouble)) {
        return ALWAYS_FALSE;
    }
    return TupleDomainFilter.DoubleRange.of(lowerDouble, low.isLowerUnbounded(), low.getBound() == Marker.Bound.ABOVE, upperDouble, high.isUpperUnbounded(), high.getBound() == Marker.Bound.BELOW, nullAllowed);
}
Also used : Marker(io.prestosql.spi.predicate.Marker)

Example 3 with Marker

use of io.prestosql.spi.predicate.Marker in project hetu-core by openlookeng.

the class TupleDomainFilterUtils method floatRangeToFilter.

private static TupleDomainFilter floatRangeToFilter(Range range, boolean nullAllowed) {
    Marker low = range.getLow();
    Marker high = range.getHigh();
    float lowerFloat = low.isLowerUnbounded() ? Float.MIN_VALUE : intBitsToFloat(toIntExact((long) low.getValue()));
    float upperFloat = high.isUpperUnbounded() ? Float.MAX_VALUE : intBitsToFloat(toIntExact((long) high.getValue()));
    if (!low.isLowerUnbounded() && Float.isNaN(lowerFloat)) {
        return ALWAYS_FALSE;
    }
    if (!high.isUpperUnbounded() && Float.isNaN(upperFloat)) {
        return ALWAYS_FALSE;
    }
    return TupleDomainFilter.FloatRange.of(lowerFloat, low.isLowerUnbounded(), low.getBound() == Marker.Bound.ABOVE, upperFloat, high.isUpperUnbounded(), high.getBound() == Marker.Bound.BELOW, nullAllowed);
}
Also used : Marker(io.prestosql.spi.predicate.Marker)

Example 4 with Marker

use of io.prestosql.spi.predicate.Marker in project hetu-core by openlookeng.

the class TupleDomainFilterUtils method longDecimalRangeToFilter.

private static TupleDomainFilter longDecimalRangeToFilter(Range range, boolean nullAllowed) {
    Marker low = range.getLow();
    Marker high = range.getHigh();
    return TupleDomainFilter.LongDecimalRange.of(low.isLowerUnbounded() ? Long.MIN_VALUE : ((Slice) low.getValue()).getLong(0), low.isLowerUnbounded() ? Long.MIN_VALUE : ((Slice) low.getValue()).getLong(SIZE_OF_LONG), low.isLowerUnbounded(), low.getBound() == Marker.Bound.ABOVE, high.isUpperUnbounded() ? Long.MAX_VALUE : ((Slice) high.getValue()).getLong(0), high.isUpperUnbounded() ? Long.MAX_VALUE : ((Slice) high.getValue()).getLong(SIZE_OF_LONG), high.isUpperUnbounded(), high.getBound() == Marker.Bound.BELOW, nullAllowed);
}
Also used : Slice(io.airlift.slice.Slice) Marker(io.prestosql.spi.predicate.Marker)

Example 5 with Marker

use of io.prestosql.spi.predicate.Marker in project hetu-core by openlookeng.

the class TupleDomainFilterUtils method varcharRangeToFilter.

private static TupleDomainFilter varcharRangeToFilter(Range range, boolean nullAllowed) {
    Marker low = range.getLow();
    Marker high = range.getHigh();
    Slice lowerValue = low.isLowerUnbounded() ? null : (Slice) low.getValue();
    Slice upperValue = high.isUpperUnbounded() ? null : (Slice) high.getValue();
    return TupleDomainFilter.BytesRange.of(lowerValue == null ? null : lowerValue.getBytes(), low.getBound() == Marker.Bound.ABOVE, upperValue == null ? null : upperValue.getBytes(), high.getBound() == Marker.Bound.BELOW, nullAllowed);
}
Also used : Slice(io.airlift.slice.Slice) Marker(io.prestosql.spi.predicate.Marker)

Aggregations

Marker (io.prestosql.spi.predicate.Marker)5 Slice (io.airlift.slice.Slice)2