本文整理了Java中com.facebook.presto.spi.predicate.Range.span
方法的一些代码示例,展示了Range.span
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.span
方法的具体详情如下:
包路径:com.facebook.presto.spi.predicate.Range
类名称:Range
方法名:span
暂无
代码示例来源:origin: prestodb/presto
public Range getSpan()
{
if (lowIndexedRanges.isEmpty()) {
throw new IllegalStateException("Can not get span if no ranges exist");
}
return lowIndexedRanges.firstEntry().getValue().span(lowIndexedRanges.lastEntry().getValue());
}
代码示例来源: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
@Test
public void testSpan()
{
assertEquals(Range.greaterThan(BIGINT, 1L).span(Range.lessThanOrEqual(BIGINT, 2L)), Range.all(BIGINT));
assertEquals(Range.greaterThan(BIGINT, 2L).span(Range.lessThanOrEqual(BIGINT, 0L)), Range.all(BIGINT));
assertEquals(Range.range(BIGINT, 1L, true, 3L, false).span(Range.equal(BIGINT, 2L)), Range.range(BIGINT, 1L, true, 3L, false));
assertEquals(Range.range(BIGINT, 1L, true, 3L, false).span(Range.range(BIGINT, 2L, false, 10L, false)), Range.range(BIGINT, 1L, true, 10L, false));
assertEquals(Range.greaterThan(BIGINT, 1L).span(Range.equal(BIGINT, 0L)), Range.greaterThanOrEqual(BIGINT, 0L));
assertEquals(Range.greaterThan(BIGINT, 1L).span(Range.greaterThanOrEqual(BIGINT, 10L)), Range.greaterThan(BIGINT, 1L));
assertEquals(Range.lessThan(BIGINT, 1L).span(Range.lessThanOrEqual(BIGINT, 1L)), Range.lessThanOrEqual(BIGINT, 1L));
assertEquals(Range.all(BIGINT).span(Range.lessThanOrEqual(BIGINT, 1L)), Range.all(BIGINT));
}
代码示例来源:origin: com.facebook.presto/presto-spi
public Range getSpan()
{
if (lowIndexedRanges.isEmpty()) {
throw new IllegalStateException("Can not get span if no ranges exist");
}
return lowIndexedRanges.firstEntry().getValue().span(lowIndexedRanges.lastEntry().getValue());
}
代码示例来源:origin: com.facebook.presto/presto-spi
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);
}
}
内容来源于网络,如有侵权,请联系作者删除!