本文整理了Java中com.facebook.presto.spi.predicate.Marker.above()
方法的一些代码示例,展示了Marker.above()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Marker.above()
方法的具体详情如下:
包路径:com.facebook.presto.spi.predicate.Marker
类名称:Marker
方法名:above
暂无
代码示例来源:origin: prestodb/presto
public static Range greaterThan(Type type, Object low)
{
return new Range(Marker.above(type, low), Marker.upperUnbounded(type));
}
代码示例来源:origin: prestodb/presto
public static Range range(Type type, Object low, boolean lowInclusive, Object high, boolean highInclusive)
{
Marker lowMarker = lowInclusive ? Marker.exactly(type, low) : Marker.above(type, low);
Marker highMarker = highInclusive ? Marker.exactly(type, high) : Marker.below(type, high);
return new Range(lowMarker, highMarker);
}
代码示例来源:origin: prestodb/presto
@Setup(Level.Iteration)
public void init()
{
ranges = new ArrayList<>();
int factor = 0;
for (int i = 0; i < 10000; i++) {
long from = ThreadLocalRandom.current().nextLong(100) + factor * 100;
long to = ThreadLocalRandom.current().nextLong(100) + (factor + 1) * 100;
factor++;
ranges.add(new Range(Marker.above(BIGINT, from), Marker.below(BIGINT, to)));
}
}
}
代码示例来源: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 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
.addDeserializer(Block.class, new TestingBlockJsonSerde.Deserializer(blockEncodingSerde)));
Marker marker = Marker.above(BIGINT, 0L);
assertEquals(marker, mapper.readValue(mapper.writeValueAsString(marker), Marker.class));
代码示例来源: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 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 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
.put(Marker.above(BIGINT, 0L), -100)
.put(Marker.below(BIGINT, 1L), -1)
.put(Marker.exactly(BIGINT, 1L), 0)
.put(Marker.above(BIGINT, 1L), 1)
.put(Marker.below(BIGINT, 2L), 100)
.put(Marker.upperUnbounded(BIGINT), 1000)
assertEquals(Marker.exactly(BIGINT, 1L).greaterAdjacent(), Marker.above(BIGINT, 1L));
assertEquals(Marker.above(BIGINT, 1L).lesserAdjacent(), Marker.exactly(BIGINT, 1L));
assertEquals(Marker.exactly(BIGINT, 1L).lesserAdjacent(), Marker.below(BIGINT, 1L));
Marker.above(BIGINT, 1L).greaterAdjacent();
fail();
代码示例来源:origin: com.facebook.presto/presto-spi
public static Range greaterThan(Type type, Object low)
{
return new Range(Marker.above(type, low), Marker.upperUnbounded(type));
}
代码示例来源:origin: com.facebook.presto/presto-spi
public static Range range(Type type, Object low, boolean lowInclusive, Object high, boolean highInclusive)
{
Marker lowMarker = lowInclusive ? Marker.exactly(type, low) : Marker.above(type, low);
Marker highMarker = highInclusive ? Marker.exactly(type, high) : Marker.below(type, high);
return new Range(lowMarker, highMarker);
}
内容来源于网络,如有侵权,请联系作者删除!