io.prestosql.spi.predicate.Range.span()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(178)

本文整理了Java中io.prestosql.spi.predicate.Range.span方法的一些代码示例,展示了Range.span的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.span方法的具体详情如下:
包路径:io.prestosql.spi.predicate.Range
类名称:Range
方法名:span

Range.span介绍

暂无

代码示例

代码示例来源:origin: prestosql/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: prestosql/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: prestosql/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: io.prestosql/presto-spi

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

相关文章