本文整理了Java中com.facebook.presto.spi.predicate.Marker.lowerUnbounded()
方法的一些代码示例,展示了Marker.lowerUnbounded()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Marker.lowerUnbounded()
方法的具体详情如下:
包路径:com.facebook.presto.spi.predicate.Marker
类名称:Marker
方法名:lowerUnbounded
暂无
代码示例来源:origin: prestodb/presto
public static Range all(Type type)
{
return new Range(Marker.lowerUnbounded(type), Marker.upperUnbounded(type));
}
代码示例来源:origin: prestodb/presto
public static Range lessThanOrEqual(Type type, Object high)
{
return new Range(Marker.lowerUnbounded(type), Marker.exactly(type, high));
}
代码示例来源:origin: prestodb/presto
public static Range lessThan(Type type, Object high)
{
return new Range(Marker.lowerUnbounded(type), Marker.below(type, high));
}
代码示例来源:origin: prestodb/presto
@Test(expectedExceptions = IllegalArgumentException.class)
public void testLowerUnboundedOnly()
{
new Range(Marker.lowerUnbounded(BIGINT), Marker.lowerUnbounded(BIGINT));
}
代码示例来源:origin: prestodb/presto
@Test
public void testTypes()
{
assertEquals(Marker.lowerUnbounded(BIGINT).getType(), BIGINT);
assertEquals(Marker.below(BIGINT, 1L).getType(), BIGINT);
assertEquals(Marker.exactly(BIGINT, 1L).getType(), BIGINT);
assertEquals(Marker.above(BIGINT, 1L).getType(), BIGINT);
assertEquals(Marker.upperUnbounded(BIGINT).getType(), 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
assertEquals(marker, mapper.readValue(mapper.writeValueAsString(marker), Marker.class));
marker = Marker.lowerUnbounded(BIGINT);
assertEquals(marker, mapper.readValue(mapper.writeValueAsString(marker), Marker.class));
代码示例来源:origin: prestodb/presto
@Test
public void testComparisons()
{
ImmutableList<Marker> markers = ImmutableList.of(
Marker.lowerUnbounded(BIGINT),
Marker.above(BIGINT, 0L),
Marker.below(BIGINT, 1L),
Marker.exactly(BIGINT, 1L),
Marker.above(BIGINT, 1L),
Marker.below(BIGINT, 2L),
Marker.upperUnbounded(BIGINT));
assertTrue(Ordering.natural().isStrictlyOrdered(markers));
// Compare every marker with every other marker
// Since the markers are strictly ordered, the value of the comparisons should be equivalent to the comparisons
// of their indexes.
for (int i = 0; i < markers.size(); i++) {
for (int j = 0; j < markers.size(); j++) {
assertTrue(markers.get(i).compareTo(markers.get(j)) == Integer.compare(i, j));
}
}
}
代码示例来源: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 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 testEmptySet()
{
SortedRangeSet rangeSet = SortedRangeSet.none(BIGINT);
assertEquals(rangeSet.getType(), BIGINT);
assertTrue(rangeSet.isNone());
assertFalse(rangeSet.isAll());
assertFalse(rangeSet.isSingleValue());
assertTrue(Iterables.isEmpty(rangeSet.getOrderedRanges()));
assertEquals(rangeSet.getRangeCount(), 0);
assertEquals(rangeSet.complement(), SortedRangeSet.all(BIGINT));
assertFalse(rangeSet.includesMarker(Marker.lowerUnbounded(BIGINT)));
assertFalse(rangeSet.includesMarker(Marker.exactly(BIGINT, 0L)));
assertFalse(rangeSet.includesMarker(Marker.upperUnbounded(BIGINT)));
}
代码示例来源:origin: prestodb/presto
@Test
public void testEntireSet()
{
SortedRangeSet rangeSet = SortedRangeSet.all(BIGINT);
assertEquals(rangeSet.getType(), BIGINT);
assertFalse(rangeSet.isNone());
assertTrue(rangeSet.isAll());
assertFalse(rangeSet.isSingleValue());
assertEquals(rangeSet.getRangeCount(), 1);
assertEquals(rangeSet.complement(), SortedRangeSet.none(BIGINT));
assertTrue(rangeSet.includesMarker(Marker.lowerUnbounded(BIGINT)));
assertTrue(rangeSet.includesMarker(Marker.exactly(BIGINT, 0L)));
assertTrue(rangeSet.includesMarker(Marker.upperUnbounded(BIGINT)));
}
代码示例来源:origin: prestodb/presto
@Test
public void testUnbounded()
{
assertTrue(Marker.lowerUnbounded(BIGINT).isLowerUnbounded());
assertFalse(Marker.lowerUnbounded(BIGINT).isUpperUnbounded());
assertTrue(Marker.upperUnbounded(BIGINT).isUpperUnbounded());
assertFalse(Marker.upperUnbounded(BIGINT).isLowerUnbounded());
assertFalse(Marker.below(BIGINT, 1L).isLowerUnbounded());
assertFalse(Marker.below(BIGINT, 1L).isUpperUnbounded());
assertFalse(Marker.exactly(BIGINT, 1L).isLowerUnbounded());
assertFalse(Marker.exactly(BIGINT, 1L).isUpperUnbounded());
assertFalse(Marker.above(BIGINT, 1L).isLowerUnbounded());
assertFalse(Marker.above(BIGINT, 1L).isUpperUnbounded());
}
代码示例来源: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 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 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)));
}
代码示例来源:origin: prestodb/presto
@Test
public void testSingleValue()
{
SortedRangeSet rangeSet = SortedRangeSet.of(BIGINT, 10L);
SortedRangeSet complement = SortedRangeSet.of(Range.greaterThan(BIGINT, 10L), Range.lessThan(BIGINT, 10L));
assertEquals(rangeSet.getType(), BIGINT);
assertFalse(rangeSet.isNone());
assertFalse(rangeSet.isAll());
assertTrue(rangeSet.isSingleValue());
assertTrue(Iterables.elementsEqual(rangeSet.getOrderedRanges(), ImmutableList.of(Range.equal(BIGINT, 10L))));
assertEquals(rangeSet.getRangeCount(), 1);
assertEquals(rangeSet.complement(), complement);
assertFalse(rangeSet.includesMarker(Marker.lowerUnbounded(BIGINT)));
assertTrue(rangeSet.includesMarker(Marker.exactly(BIGINT, 10L)));
assertFalse(rangeSet.includesMarker(Marker.exactly(BIGINT, 9L)));
assertFalse(rangeSet.includesMarker(Marker.upperUnbounded(BIGINT)));
}
代码示例来源: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
assertEquals(rangeSet.getRangeCount(), 3);
assertEquals(rangeSet.complement(), complement);
assertTrue(rangeSet.includesMarker(Marker.lowerUnbounded(BIGINT)));
assertTrue(rangeSet.includesMarker(Marker.exactly(BIGINT, 0L)));
assertTrue(rangeSet.includesMarker(Marker.exactly(BIGINT, 4L)));
内容来源于网络,如有侵权,请联系作者删除!