本文整理了Java中io.prestosql.spi.predicate.Range.all
方法的一些代码示例,展示了Range.all
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.all
方法的具体详情如下:
包路径:io.prestosql.spi.predicate.Range
类名称:Range
方法名:all
暂无
代码示例来源:origin: prestosql/presto
static SortedRangeSet all(Type type)
{
return copyOf(type, Collections.singletonList(Range.all(type)));
}
代码示例来源:origin: io.prestosql/presto-spi
.addDeserializer(Block.class, new TestingBlockJsonSerde.Deserializer(blockEncodingSerde)));
Range range = Range.all(BIGINT);
assertEquals(range, mapper.readValue(mapper.writeValueAsString(range), Range.class));
代码示例来源:origin: prestosql/presto
.addDeserializer(Block.class, new TestingBlockJsonSerde.Deserializer(blockEncodingSerde)));
Range range = Range.all(BIGINT);
assertEquals(range, mapper.readValue(mapper.writeValueAsString(range), Range.class));
代码示例来源: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));
}
代码示例来源:origin: io.prestosql/presto-spi
@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: io.prestosql/presto-spi
@Test
public void testContains()
{
assertTrue(Range.all(BIGINT).contains(Range.all(BIGINT)));
assertTrue(Range.all(BIGINT).contains(Range.equal(BIGINT, 0L)));
assertTrue(Range.all(BIGINT).contains(Range.greaterThan(BIGINT, 0L)));
assertTrue(Range.equal(BIGINT, 0L).contains(Range.equal(BIGINT, 0L)));
assertFalse(Range.equal(BIGINT, 0L).contains(Range.greaterThan(BIGINT, 0L)));
assertFalse(Range.equal(BIGINT, 0L).contains(Range.greaterThanOrEqual(BIGINT, 0L)));
assertFalse(Range.equal(BIGINT, 0L).contains(Range.all(BIGINT)));
assertTrue(Range.greaterThanOrEqual(BIGINT, 0L).contains(Range.greaterThan(BIGINT, 0L)));
assertTrue(Range.greaterThan(BIGINT, 0L).contains(Range.greaterThan(BIGINT, 1L)));
assertFalse(Range.greaterThan(BIGINT, 0L).contains(Range.lessThan(BIGINT, 0L)));
assertTrue(Range.range(BIGINT, 0L, true, 2L, true).contains(Range.range(BIGINT, 1L, true, 2L, true)));
assertFalse(Range.range(BIGINT, 0L, true, 2L, true).contains(Range.range(BIGINT, 1L, true, 3L, false)));
}
代码示例来源: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: prestosql/presto
@Test
public void testContains()
{
assertTrue(Range.all(BIGINT).contains(Range.all(BIGINT)));
assertTrue(Range.all(BIGINT).contains(Range.equal(BIGINT, 0L)));
assertTrue(Range.all(BIGINT).contains(Range.greaterThan(BIGINT, 0L)));
assertTrue(Range.equal(BIGINT, 0L).contains(Range.equal(BIGINT, 0L)));
assertFalse(Range.equal(BIGINT, 0L).contains(Range.greaterThan(BIGINT, 0L)));
assertFalse(Range.equal(BIGINT, 0L).contains(Range.greaterThanOrEqual(BIGINT, 0L)));
assertFalse(Range.equal(BIGINT, 0L).contains(Range.all(BIGINT)));
assertTrue(Range.greaterThanOrEqual(BIGINT, 0L).contains(Range.greaterThan(BIGINT, 0L)));
assertTrue(Range.greaterThan(BIGINT, 0L).contains(Range.greaterThan(BIGINT, 1L)));
assertFalse(Range.greaterThan(BIGINT, 0L).contains(Range.lessThan(BIGINT, 0L)));
assertTrue(Range.range(BIGINT, 0L, true, 2L, true).contains(Range.range(BIGINT, 1L, true, 2L, true)));
assertFalse(Range.range(BIGINT, 0L, true, 2L, true).contains(Range.range(BIGINT, 1L, true, 3L, false)));
}
代码示例来源:origin: prestosql/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: prestosql/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: io.prestosql/presto-spi
@Test
public void testOverlaps()
{
assertTrue(Range.greaterThan(BIGINT, 1L).overlaps(Range.lessThanOrEqual(BIGINT, 2L)));
assertFalse(Range.greaterThan(BIGINT, 2L).overlaps(Range.lessThan(BIGINT, 2L)));
assertTrue(Range.range(BIGINT, 1L, true, 3L, false).overlaps(Range.equal(BIGINT, 2L)));
assertTrue(Range.range(BIGINT, 1L, true, 3L, false).overlaps(Range.range(BIGINT, 2L, false, 10L, false)));
assertFalse(Range.range(BIGINT, 1L, true, 3L, false).overlaps(Range.range(BIGINT, 3L, true, 10L, false)));
assertTrue(Range.range(BIGINT, 1L, true, 3L, true).overlaps(Range.range(BIGINT, 3L, true, 10L, false)));
assertTrue(Range.all(BIGINT).overlaps(Range.equal(BIGINT, Long.MAX_VALUE)));
}
代码示例来源:origin: prestosql/presto
@Test
public void testOverlaps()
{
assertTrue(Range.greaterThan(BIGINT, 1L).overlaps(Range.lessThanOrEqual(BIGINT, 2L)));
assertFalse(Range.greaterThan(BIGINT, 2L).overlaps(Range.lessThan(BIGINT, 2L)));
assertTrue(Range.range(BIGINT, 1L, true, 3L, false).overlaps(Range.equal(BIGINT, 2L)));
assertTrue(Range.range(BIGINT, 1L, true, 3L, false).overlaps(Range.range(BIGINT, 2L, false, 10L, false)));
assertFalse(Range.range(BIGINT, 1L, true, 3L, false).overlaps(Range.range(BIGINT, 3L, true, 10L, false)));
assertTrue(Range.range(BIGINT, 1L, true, 3L, true).overlaps(Range.range(BIGINT, 3L, true, 10L, false)));
assertTrue(Range.all(BIGINT).overlaps(Range.equal(BIGINT, Long.MAX_VALUE)));
}
代码示例来源:origin: prestosql/presto
@Test
public void testSpan()
{
try {
SortedRangeSet.none(BIGINT).getSpan();
fail();
}
catch (IllegalStateException e) {
}
assertEquals(SortedRangeSet.all(BIGINT).getSpan(), Range.all(BIGINT));
assertEquals(SortedRangeSet.of(BIGINT, 0L).getSpan(), Range.equal(BIGINT, 0L));
assertEquals(SortedRangeSet.of(Range.equal(BIGINT, 0L), Range.equal(BIGINT, 1L)).getSpan(), Range.range(BIGINT, 0L, true, 1L, true));
assertEquals(SortedRangeSet.of(Range.equal(BIGINT, 0L), Range.greaterThan(BIGINT, 1L)).getSpan(), Range.greaterThanOrEqual(BIGINT, 0L));
assertEquals(SortedRangeSet.of(Range.lessThan(BIGINT, 0L), Range.greaterThan(BIGINT, 1L)).getSpan(), Range.all(BIGINT));
}
代码示例来源:origin: io.prestosql/presto-spi
@Test
public void testSpan()
{
try {
SortedRangeSet.none(BIGINT).getSpan();
fail();
}
catch (IllegalStateException e) {
}
assertEquals(SortedRangeSet.all(BIGINT).getSpan(), Range.all(BIGINT));
assertEquals(SortedRangeSet.of(BIGINT, 0L).getSpan(), Range.equal(BIGINT, 0L));
assertEquals(SortedRangeSet.of(Range.equal(BIGINT, 0L), Range.equal(BIGINT, 1L)).getSpan(), Range.range(BIGINT, 0L, true, 1L, true));
assertEquals(SortedRangeSet.of(Range.equal(BIGINT, 0L), Range.greaterThan(BIGINT, 1L)).getSpan(), Range.greaterThanOrEqual(BIGINT, 0L));
assertEquals(SortedRangeSet.of(Range.lessThan(BIGINT, 0L), Range.greaterThan(BIGINT, 1L)).getSpan(), Range.all(BIGINT));
}
代码示例来源:origin: prestosql/presto
@Test
public void testIntersect()
{
assertEquals(Range.greaterThan(BIGINT, 1L).intersect(Range.lessThanOrEqual(BIGINT, 2L)), Range.range(BIGINT, 1L, false, 2L, true));
assertEquals(Range.range(BIGINT, 1L, true, 3L, false).intersect(Range.equal(BIGINT, 2L)), Range.equal(BIGINT, 2L));
assertEquals(Range.range(BIGINT, 1L, true, 3L, false).intersect(Range.range(BIGINT, 2L, false, 10L, false)), Range.range(BIGINT, 2L, false, 3L, false));
assertEquals(Range.range(BIGINT, 1L, true, 3L, true).intersect(Range.range(BIGINT, 3L, true, 10L, false)), Range.equal(BIGINT, 3L));
assertEquals(Range.all(BIGINT).intersect(Range.equal(BIGINT, Long.MAX_VALUE)), Range.equal(BIGINT, Long.MAX_VALUE));
}
代码示例来源:origin: io.prestosql/presto-spi
@Test
public void testIntersect()
{
assertEquals(Range.greaterThan(BIGINT, 1L).intersect(Range.lessThanOrEqual(BIGINT, 2L)), Range.range(BIGINT, 1L, false, 2L, true));
assertEquals(Range.range(BIGINT, 1L, true, 3L, false).intersect(Range.equal(BIGINT, 2L)), Range.equal(BIGINT, 2L));
assertEquals(Range.range(BIGINT, 1L, true, 3L, false).intersect(Range.range(BIGINT, 2L, false, 10L, false)), Range.range(BIGINT, 2L, false, 3L, false));
assertEquals(Range.range(BIGINT, 1L, true, 3L, true).intersect(Range.range(BIGINT, 3L, true, 10L, false)), Range.equal(BIGINT, 3L));
assertEquals(Range.all(BIGINT).intersect(Range.equal(BIGINT, Long.MAX_VALUE)), Range.equal(BIGINT, Long.MAX_VALUE));
}
代码示例来源:origin: io.prestosql/presto-spi
@Test
public void testUnion()
{
assertUnion(SortedRangeSet.none(BIGINT), SortedRangeSet.none(BIGINT), SortedRangeSet.none(BIGINT));
assertUnion(SortedRangeSet.all(BIGINT), SortedRangeSet.all(BIGINT), SortedRangeSet.all(BIGINT));
assertUnion(SortedRangeSet.none(BIGINT), SortedRangeSet.all(BIGINT), SortedRangeSet.all(BIGINT));
assertUnion(
SortedRangeSet.of(Range.equal(BIGINT, 1L), Range.equal(BIGINT, 2L)),
SortedRangeSet.of(Range.equal(BIGINT, 2L), Range.equal(BIGINT, 3L)),
SortedRangeSet.of(Range.equal(BIGINT, 1L), Range.equal(BIGINT, 2L), Range.equal(BIGINT, 3L)));
assertUnion(SortedRangeSet.all(BIGINT), SortedRangeSet.of(Range.equal(BIGINT, 0L)), SortedRangeSet.all(BIGINT));
assertUnion(
SortedRangeSet.of(Range.range(BIGINT, 0L, true, 4L, false)),
SortedRangeSet.of(Range.greaterThan(BIGINT, 3L)),
SortedRangeSet.of(Range.greaterThanOrEqual(BIGINT, 0L)));
assertUnion(
SortedRangeSet.of(Range.greaterThanOrEqual(BIGINT, 0L)),
SortedRangeSet.of(Range.lessThanOrEqual(BIGINT, 0L)),
SortedRangeSet.of(Range.all(BIGINT)));
assertUnion(
SortedRangeSet.of(Range.greaterThan(BIGINT, 0L)),
SortedRangeSet.of(Range.lessThan(BIGINT, 0L)),
SortedRangeSet.of(BIGINT, 0L).complement());
}
代码示例来源:origin: prestosql/presto
@Test
public void testUnion()
{
assertUnion(SortedRangeSet.none(BIGINT), SortedRangeSet.none(BIGINT), SortedRangeSet.none(BIGINT));
assertUnion(SortedRangeSet.all(BIGINT), SortedRangeSet.all(BIGINT), SortedRangeSet.all(BIGINT));
assertUnion(SortedRangeSet.none(BIGINT), SortedRangeSet.all(BIGINT), SortedRangeSet.all(BIGINT));
assertUnion(
SortedRangeSet.of(Range.equal(BIGINT, 1L), Range.equal(BIGINT, 2L)),
SortedRangeSet.of(Range.equal(BIGINT, 2L), Range.equal(BIGINT, 3L)),
SortedRangeSet.of(Range.equal(BIGINT, 1L), Range.equal(BIGINT, 2L), Range.equal(BIGINT, 3L)));
assertUnion(SortedRangeSet.all(BIGINT), SortedRangeSet.of(Range.equal(BIGINT, 0L)), SortedRangeSet.all(BIGINT));
assertUnion(
SortedRangeSet.of(Range.range(BIGINT, 0L, true, 4L, false)),
SortedRangeSet.of(Range.greaterThan(BIGINT, 3L)),
SortedRangeSet.of(Range.greaterThanOrEqual(BIGINT, 0L)));
assertUnion(
SortedRangeSet.of(Range.greaterThanOrEqual(BIGINT, 0L)),
SortedRangeSet.of(Range.lessThanOrEqual(BIGINT, 0L)),
SortedRangeSet.of(Range.all(BIGINT)));
assertUnion(
SortedRangeSet.of(Range.greaterThan(BIGINT, 0L)),
SortedRangeSet.of(Range.lessThan(BIGINT, 0L)),
SortedRangeSet.of(BIGINT, 0L).complement());
}
内容来源于网络,如有侵权,请联系作者删除!