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);
}
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);
}
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);
}
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);
}
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);
}