本文整理了Java中com.facebook.presto.spi.predicate.Range.getLow
方法的一些代码示例,展示了Range.getLow
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.getLow
方法的具体详情如下:
包路径:com.facebook.presto.spi.predicate.Range
类名称:Range
方法名:getLow
暂无
代码示例来源:origin: prestodb/presto
SortedRangeSet build()
{
Collections.sort(ranges, Comparator.comparing(Range::getLow));
NavigableMap<Marker, Range> result = new TreeMap<>();
Range current = null;
for (Range next : ranges) {
if (current == null) {
current = next;
continue;
}
if (current.overlaps(next) || current.getHigh().isAdjacent(next.getLow())) {
current = current.span(next);
}
else {
result.put(current.getLow(), current);
current = next;
}
}
if (current != null) {
result.put(current.getLow(), current);
}
return new SortedRangeSet(type, result);
}
}
代码示例来源:origin: prestodb/presto
public boolean contains(Range other)
{
checkTypeCompatibility(other);
return this.getLow().compareTo(other.getLow()) <= 0 &&
this.getHigh().compareTo(other.getHigh()) >= 0;
}
代码示例来源:origin: prestodb/presto
public boolean overlaps(Range other)
{
checkTypeCompatibility(other);
return this.getLow().compareTo(other.getHigh()) <= 0 &&
other.getLow().compareTo(this.getHigh()) <= 0;
}
代码示例来源:origin: prestodb/presto
private static boolean isBetween(Range range)
{
return !range.getLow().isLowerUnbounded() && range.getLow().getBound() == Marker.Bound.EXACTLY
&& !range.getHigh().isUpperUnbounded() && range.getHigh().getBound() == Marker.Bound.EXACTLY;
}
代码示例来源:origin: prestodb/presto
private FormattedDomain parseDomain(Domain domain)
{
ImmutableSet.Builder<FormattedRange> formattedRanges = ImmutableSet.builder();
Type type = domain.getType();
domain.getValues().getValuesProcessor().consume(
ranges -> formattedRanges.addAll(
ranges.getOrderedRanges().stream()
.map(range -> new FormattedRange(formatMarker(range.getLow()), formatMarker(range.getHigh())))
.collect(toImmutableSet())),
discreteValues -> formattedRanges.addAll(
discreteValues.getValues().stream()
.map(value -> getVarcharValue(type, value))
.map(value -> new FormattedMarker(Optional.of(value), EXACTLY))
.map(marker -> new FormattedRange(marker, marker))
.collect(toImmutableSet())),
allOrNone -> {
throw new IllegalStateException("Unreachable AllOrNone consumer");
});
return new FormattedDomain(domain.isNullAllowed(), formattedRanges.build());
}
代码示例来源:origin: prestodb/presto
public static PrestoThriftRange fromRange(Range range)
{
return new PrestoThriftRange(fromMarker(range.getLow()), fromMarker(range.getHigh()));
}
}
代码示例来源:origin: prestodb/presto
builder.append((range.getLow().getBound() == Marker.Bound.EXACTLY) ? '[' : '(');
if (range.getLow().isLowerUnbounded()) {
builder.append("<min>");
builder.append(castToVarchar(type, range.getLow().getValue(), functionRegistry, session));
代码示例来源:origin: prestodb/presto
public Range intersect(Range other)
{
checkTypeCompatibility(other);
if (!this.overlaps(other)) {
throw new IllegalArgumentException("Cannot intersect non-overlapping ranges");
}
Marker lowMarker = Marker.max(low, other.getLow());
Marker highMarker = Marker.min(high, other.getHigh());
return new Range(lowMarker, highMarker);
}
代码示例来源:origin: prestodb/presto
public Range span(Range other)
{
checkTypeCompatibility(other);
Marker lowMarker = Marker.min(low, other.getLow());
Marker highMarker = Marker.max(high, other.getHigh());
return new Range(lowMarker, highMarker);
}
代码示例来源:origin: prestodb/presto
return new BetweenPredicate(reference, literalEncoder.toExpression(range.getLow().getValue(), type), literalEncoder.toExpression(range.getHigh().getValue(), type));
if (!range.getLow().isLowerUnbounded()) {
switch (range.getLow().getBound()) {
case ABOVE:
rangeConjuncts.add(new ComparisonExpression(GREATER_THAN, reference, literalEncoder.toExpression(range.getLow().getValue(), type)));
break;
case EXACTLY:
rangeConjuncts.add(new ComparisonExpression(GREATER_THAN_OR_EQUAL, reference, literalEncoder.toExpression(range.getLow().getValue(),
type)));
break;
throw new IllegalStateException("Low Marker should never use BELOW bound: " + range);
default:
throw new AssertionError("Unhandled bound: " + range.getLow().getBound());
代码示例来源:origin: prestodb/presto
@Override
public SortedRangeSet complement()
{
Builder builder = new Builder(type);
if (lowIndexedRanges.isEmpty()) {
return builder.add(Range.all(type)).build();
}
Iterator<Range> rangeIterator = lowIndexedRanges.values().iterator();
Range firstRange = rangeIterator.next();
if (!firstRange.getLow().isLowerUnbounded()) {
builder.add(new Range(Marker.lowerUnbounded(type), firstRange.getLow().lesserAdjacent()));
}
Range previousRange = firstRange;
while (rangeIterator.hasNext()) {
Range currentRange = rangeIterator.next();
Marker lowMarker = previousRange.getHigh().greaterAdjacent();
Marker highMarker = currentRange.getLow().lesserAdjacent();
builder.add(new Range(lowMarker, highMarker));
previousRange = currentRange;
}
Range lastRange = previousRange;
if (!lastRange.getHigh().isUpperUnbounded()) {
builder.add(new Range(lastRange.getHigh().greaterAdjacent(), Marker.upperUnbounded(type)));
}
return builder.build();
}
代码示例来源:origin: prestodb/presto
if (prestoRange.getLow().isLowerUnbounded()) {
boolean inclusive = prestoRange.getLow().getBound() == Bound.EXACTLY;
Text split = new Text(serializer.encode(prestoRange.getType(), prestoRange.getLow().getValue()));
accumuloRange = new Range(split, inclusive, null, false);
boolean startKeyInclusive = prestoRange.getLow().getBound() == Bound.EXACTLY;
Text startSplit = new Text(serializer.encode(prestoRange.getType(), prestoRange.getLow().getValue()));
代码示例来源:origin: prestodb/presto
checkState(!range.isAll(), "Invalid range for column: " + columnName);
if (range.isSingleValue()) {
valuesToInclude.add(range.getLow().getValue());
if (!range.getLow().isLowerUnbounded()) {
switch (range.getLow().getBound()) {
case ABOVE:
rangeQueryBuilder.must(new RangeQueryBuilder(columnName).gt(getValue(type, range.getLow().getValue())));
break;
case EXACTLY:
rangeQueryBuilder.must(new RangeQueryBuilder(columnName).gte(getValue(type, range.getLow().getValue())));
break;
case BELOW:
throw new IllegalArgumentException("Low marker should never use BELOW bound");
default:
throw new AssertionError("Unhandled bound: " + range.getLow().getBound());
代码示例来源:origin: prestodb/presto
@Test
public void testGreaterThanRange()
{
Range range = Range.greaterThan(BIGINT, 1L);
assertEquals(range.getLow(), Marker.above(BIGINT, 1L));
assertEquals(range.getHigh(), Marker.upperUnbounded(BIGINT));
assertFalse(range.isSingleValue());
assertFalse(range.isAll());
assertEquals(range.getType(), BIGINT);
assertFalse(range.includes(Marker.lowerUnbounded(BIGINT)));
assertFalse(range.includes(Marker.exactly(BIGINT, 1L)));
assertTrue(range.includes(Marker.exactly(BIGINT, 2L)));
assertTrue(range.includes(Marker.upperUnbounded(BIGINT)));
}
代码示例来源:origin: prestodb/presto
@Test
public void testLessThanRange()
{
Range range = Range.lessThan(BIGINT, 1L);
assertEquals(range.getLow(), Marker.lowerUnbounded(BIGINT));
assertEquals(range.getHigh(), Marker.below(BIGINT, 1L));
assertFalse(range.isSingleValue());
assertFalse(range.isAll());
assertEquals(range.getType(), BIGINT);
assertTrue(range.includes(Marker.lowerUnbounded(BIGINT)));
assertFalse(range.includes(Marker.exactly(BIGINT, 1L)));
assertTrue(range.includes(Marker.exactly(BIGINT, 0L)));
assertFalse(range.includes(Marker.upperUnbounded(BIGINT)));
}
代码示例来源:origin: prestodb/presto
@Test
public void testAllRange()
{
Range range = Range.all(BIGINT);
assertEquals(range.getLow(), Marker.lowerUnbounded(BIGINT));
assertEquals(range.getHigh(), Marker.upperUnbounded(BIGINT));
assertFalse(range.isSingleValue());
assertTrue(range.isAll());
assertEquals(range.getType(), BIGINT);
assertTrue(range.includes(Marker.lowerUnbounded(BIGINT)));
assertTrue(range.includes(Marker.below(BIGINT, 1L)));
assertTrue(range.includes(Marker.exactly(BIGINT, 1L)));
assertTrue(range.includes(Marker.above(BIGINT, 1L)));
assertTrue(range.includes(Marker.upperUnbounded(BIGINT)));
}
代码示例来源:origin: prestodb/presto
@Test
public void testGreaterThanOrEqualRange()
{
Range range = Range.greaterThanOrEqual(BIGINT, 1L);
assertEquals(range.getLow(), Marker.exactly(BIGINT, 1L));
assertEquals(range.getHigh(), Marker.upperUnbounded(BIGINT));
assertFalse(range.isSingleValue());
assertFalse(range.isAll());
assertEquals(range.getType(), BIGINT);
assertFalse(range.includes(Marker.lowerUnbounded(BIGINT)));
assertFalse(range.includes(Marker.exactly(BIGINT, 0L)));
assertTrue(range.includes(Marker.exactly(BIGINT, 1L)));
assertTrue(range.includes(Marker.exactly(BIGINT, 2L)));
assertTrue(range.includes(Marker.upperUnbounded(BIGINT)));
}
代码示例来源:origin: prestodb/presto
@Test
public void testEqualRange()
{
Range range = Range.equal(BIGINT, 1L);
assertEquals(range.getLow(), Marker.exactly(BIGINT, 1L));
assertEquals(range.getHigh(), Marker.exactly(BIGINT, 1L));
assertTrue(range.isSingleValue());
assertFalse(range.isAll());
assertEquals(range.getType(), BIGINT);
assertFalse(range.includes(Marker.lowerUnbounded(BIGINT)));
assertFalse(range.includes(Marker.exactly(BIGINT, 0L)));
assertTrue(range.includes(Marker.exactly(BIGINT, 1L)));
assertFalse(range.includes(Marker.exactly(BIGINT, 2L)));
assertFalse(range.includes(Marker.upperUnbounded(BIGINT)));
}
代码示例来源:origin: prestodb/presto
@Test
public void testLessThanOrEqualRange()
{
Range range = Range.lessThanOrEqual(BIGINT, 1L);
assertEquals(range.getLow(), Marker.lowerUnbounded(BIGINT));
assertEquals(range.getHigh(), Marker.exactly(BIGINT, 1L));
assertFalse(range.isSingleValue());
assertFalse(range.isAll());
assertEquals(range.getType(), BIGINT);
assertTrue(range.includes(Marker.lowerUnbounded(BIGINT)));
assertFalse(range.includes(Marker.exactly(BIGINT, 2L)));
assertTrue(range.includes(Marker.exactly(BIGINT, 1L)));
assertTrue(range.includes(Marker.exactly(BIGINT, 0L)));
assertFalse(range.includes(Marker.upperUnbounded(BIGINT)));
}
代码示例来源:origin: prestodb/presto
@Test
public void testRange()
{
Range range = Range.range(BIGINT, 0L, false, 2L, true);
assertEquals(range.getLow(), Marker.above(BIGINT, 0L));
assertEquals(range.getHigh(), Marker.exactly(BIGINT, 2L));
assertFalse(range.isSingleValue());
assertFalse(range.isAll());
assertEquals(range.getType(), BIGINT);
assertFalse(range.includes(Marker.lowerUnbounded(BIGINT)));
assertFalse(range.includes(Marker.exactly(BIGINT, 0L)));
assertTrue(range.includes(Marker.exactly(BIGINT, 1L)));
assertTrue(range.includes(Marker.exactly(BIGINT, 2L)));
assertFalse(range.includes(Marker.exactly(BIGINT, 3L)));
assertFalse(range.includes(Marker.upperUnbounded(BIGINT)));
}
内容来源于网络,如有侵权,请联系作者删除!