本文整理了Java中io.prestosql.spi.predicate.Range.greaterThanOrEqual
方法的一些代码示例,展示了Range.greaterThanOrEqual
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.greaterThanOrEqual
方法的具体详情如下:
包路径:io.prestosql.spi.predicate.Range
类名称:Range
方法名:greaterThanOrEqual
暂无
代码示例来源:origin: prestosql/presto
private static <F, T extends Comparable<T>> Domain createDomain(Type type, boolean hasNullValue, RangeStatistics<F> rangeStatistics, Function<F, T> function)
{
F min = rangeStatistics.getMin();
F max = rangeStatistics.getMax();
if (min != null && max != null) {
return Domain.create(ValueSet.ofRanges(Range.range(type, function.apply(min), true, function.apply(max), true)), hasNullValue);
}
if (max != null) {
return Domain.create(ValueSet.ofRanges(Range.lessThanOrEqual(type, function.apply(max))), hasNullValue);
}
if (min != null) {
return Domain.create(ValueSet.ofRanges(Range.greaterThanOrEqual(type, function.apply(min))), hasNullValue);
}
return Domain.create(ValueSet.all(type), hasNullValue);
}
代码示例来源:origin: io.prestosql/presto-orc
private static <F, T extends Comparable<T>> Domain createDomain(Type type, boolean hasNullValue, RangeStatistics<F> rangeStatistics, Function<F, T> function)
{
F min = rangeStatistics.getMin();
F max = rangeStatistics.getMax();
if (min != null && max != null) {
return Domain.create(ValueSet.ofRanges(Range.range(type, function.apply(min), true, function.apply(max), true)), hasNullValue);
}
if (max != null) {
return Domain.create(ValueSet.ofRanges(Range.lessThanOrEqual(type, function.apply(max))), hasNullValue);
}
if (min != null) {
return Domain.create(ValueSet.ofRanges(Range.greaterThanOrEqual(type, function.apply(min))), hasNullValue);
}
return Domain.create(ValueSet.all(type), hasNullValue);
}
代码示例来源:origin: prestosql/presto
@Test
public void testRangeShardUuidPredicate()
{
Slice uuid0 = utf8Slice(randomUUID().toString());
TupleDomain<RaptorColumnHandle> tupleDomain = withColumnDomains(ImmutableMap.of(
shardUuidColumnHandle("test"),
create(SortedRangeSet.copyOf(VARCHAR, ImmutableList.of(greaterThanOrEqual(VARCHAR, uuid0))), false)));
ShardPredicate shardPredicate = ShardPredicate.create(tupleDomain);
assertEquals(shardPredicate.getPredicate(), "true");
}
代码示例来源:origin: io.prestosql/presto-spi
@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: prestosql/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: io.prestosql/presto-spi
@Test
public void testMismatchedColumnWiseUnion()
{
TupleDomain<ColumnHandle> tupleDomain1 = TupleDomain.withColumnDomains(
ImmutableMap.of(
A, Domain.all(DOUBLE),
B, Domain.singleValue(VARCHAR, utf8Slice("value"))));
TupleDomain<ColumnHandle> tupleDomain2 = TupleDomain.withColumnDomains(
ImmutableMap.of(
A, Domain.create(ValueSet.ofRanges(Range.greaterThanOrEqual(DOUBLE, 0.0)), true),
C, Domain.singleValue(BIGINT, 1L)));
TupleDomain<ColumnHandle> expectedTupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(A, Domain.all(DOUBLE)));
assertEquals(columnWiseUnion(tupleDomain1, tupleDomain2), expectedTupleDomain);
}
代码示例来源:origin: prestosql/presto
@Test
public void testMismatchedColumnWiseUnion()
{
TupleDomain<ColumnHandle> tupleDomain1 = TupleDomain.withColumnDomains(
ImmutableMap.of(
A, Domain.all(DOUBLE),
B, Domain.singleValue(VARCHAR, utf8Slice("value"))));
TupleDomain<ColumnHandle> tupleDomain2 = TupleDomain.withColumnDomains(
ImmutableMap.of(
A, Domain.create(ValueSet.ofRanges(Range.greaterThanOrEqual(DOUBLE, 0.0)), true),
C, Domain.singleValue(BIGINT, 1L)));
TupleDomain<ColumnHandle> expectedTupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(A, Domain.all(DOUBLE)));
assertEquals(columnWiseUnion(tupleDomain1, tupleDomain2), expectedTupleDomain);
}
代码示例来源:origin: io.prestosql/presto-thrift-api
@Test
public void testFromValueSetOfRangesUnbounded()
{
PrestoThriftValueSet thriftValueSet = fromValueSet(ValueSet.ofRanges(Range.greaterThanOrEqual(BIGINT, 0L)));
assertNotNull(thriftValueSet.getRangeValueSet());
assertEquals(thriftValueSet.getRangeValueSet().getRanges(), ImmutableList.of(
new PrestoThriftRange(new PrestoThriftMarker(longValue(0), EXACTLY), new PrestoThriftMarker(null, BELOW))));
}
代码示例来源:origin: prestosql/presto
@Test
public void testFromValueSetOfRangesUnbounded()
{
PrestoThriftValueSet thriftValueSet = fromValueSet(ValueSet.ofRanges(Range.greaterThanOrEqual(BIGINT, 0L)));
assertNotNull(thriftValueSet.getRangeValueSet());
assertEquals(thriftValueSet.getRangeValueSet().getRanges(), ImmutableList.of(
new PrestoThriftRange(new PrestoThriftMarker(longValue(0), EXACTLY), new PrestoThriftMarker(null, BELOW))));
}
代码示例来源:origin: io.prestosql/presto-spi
@Test
public void testMismatchedColumnIntersection()
{
TupleDomain<ColumnHandle> tupleDomain1 = TupleDomain.withColumnDomains(
ImmutableMap.of(
A, Domain.all(DOUBLE),
B, Domain.singleValue(VARCHAR, utf8Slice("value"))));
TupleDomain<ColumnHandle> tupleDomain2 = TupleDomain.withColumnDomains(
ImmutableMap.of(
A, Domain.create(ValueSet.ofRanges(Range.greaterThanOrEqual(DOUBLE, 0.0)), true),
C, Domain.singleValue(BIGINT, 1L)));
TupleDomain<ColumnHandle> expectedTupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(
A, Domain.create(ValueSet.ofRanges(Range.greaterThanOrEqual(DOUBLE, 0.0)), true),
B, Domain.singleValue(VARCHAR, utf8Slice("value")),
C, Domain.singleValue(BIGINT, 1L)));
assertEquals(tupleDomain1.intersect(tupleDomain2), expectedTupleDomain);
}
代码示例来源:origin: prestosql/presto
@Test
public void testMismatchedColumnIntersection()
{
TupleDomain<ColumnHandle> tupleDomain1 = TupleDomain.withColumnDomains(
ImmutableMap.of(
A, Domain.all(DOUBLE),
B, Domain.singleValue(VARCHAR, utf8Slice("value"))));
TupleDomain<ColumnHandle> tupleDomain2 = TupleDomain.withColumnDomains(
ImmutableMap.of(
A, Domain.create(ValueSet.ofRanges(Range.greaterThanOrEqual(DOUBLE, 0.0)), true),
C, Domain.singleValue(BIGINT, 1L)));
TupleDomain<ColumnHandle> expectedTupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(
A, Domain.create(ValueSet.ofRanges(Range.greaterThanOrEqual(DOUBLE, 0.0)), true),
B, Domain.singleValue(VARCHAR, utf8Slice("value")),
C, Domain.singleValue(BIGINT, 1L)));
assertEquals(tupleDomain1.intersect(tupleDomain2), expectedTupleDomain);
}
代码示例来源: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-orc
@Test
public void testFloat()
{
assertEquals(getDomain(REAL, 0, null), none(REAL));
assertEquals(getDomain(REAL, 10, null), all(REAL));
assertEquals(getDomain(REAL, 0, doubleColumnStats(null, null, null)), none(REAL));
assertEquals(getDomain(REAL, 0, doubleColumnStats(0L, null, null)), none(REAL));
assertEquals(getDomain(REAL, 0, doubleColumnStats(0L, (double) 42.24f, (double) 42.24f)), none(REAL));
assertEquals(getDomain(REAL, 10, doubleColumnStats(0L, null, null)), onlyNull(REAL));
assertEquals(getDomain(REAL, 10, doubleColumnStats(10L, null, null)), notNull(REAL));
assertEquals(getDomain(REAL, 10, doubleColumnStats(10L, (double) 42.24f, (double) 42.24f)), singleValue(REAL, (long) floatToRawIntBits(42.24f)));
assertEquals(getDomain(REAL, 10, doubleColumnStats(10L, 3.3, (double) 42.24f)), create(ValueSet.ofRanges(range(REAL, (long) floatToRawIntBits(3.3f), true, (long) floatToRawIntBits(42.24f), true)), false));
assertEquals(getDomain(REAL, 10, doubleColumnStats(10L, null, (double) 42.24f)), create(ValueSet.ofRanges(lessThanOrEqual(REAL, (long) floatToRawIntBits(42.24f))), false));
assertEquals(getDomain(REAL, 10, doubleColumnStats(10L, 3.3, null)), create(ValueSet.ofRanges(greaterThanOrEqual(REAL, (long) floatToRawIntBits(3.3f))), false));
assertEquals(getDomain(REAL, 10, doubleColumnStats(5L, 3.3, (double) 42.24f)), create(ValueSet.ofRanges(range(REAL, (long) floatToRawIntBits(3.3f), true, (long) floatToRawIntBits(42.24f), true)), true));
assertEquals(getDomain(REAL, 10, doubleColumnStats(5L, null, (double) 42.24f)), create(ValueSet.ofRanges(lessThanOrEqual(REAL, (long) floatToRawIntBits(42.24f))), true));
assertEquals(getDomain(REAL, 10, doubleColumnStats(5L, 3.3, null)), create(ValueSet.ofRanges(greaterThanOrEqual(REAL, (long) floatToRawIntBits(3.3f))), true));
}
代码示例来源:origin: prestosql/presto
@Test
public void testBuildQueryStringType()
{
TupleDomain<ColumnHandle> tupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(
COL1, Domain.create(ValueSet.ofRanges(range(createUnboundedVarcharType(), utf8Slice("hello"), false, utf8Slice("world"), true)), false),
COL2, Domain.create(ValueSet.ofRanges(greaterThanOrEqual(createUnboundedVarcharType(), utf8Slice("a value"))), false)));
Document query = MongoSession.buildQuery(tupleDomain);
Document expected = new Document()
.append(COL1.getName(), new Document().append("$gt", "hello").append("$lte", "world"))
.append(COL2.getName(), new Document("$gte", "a value"));
assertEquals(query, expected);
}
代码示例来源: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 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 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: 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 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-orc
@Test
public void testDouble()
{
assertEquals(getDomain(DOUBLE, 0, null), none(DOUBLE));
assertEquals(getDomain(DOUBLE, 10, null), all(DOUBLE));
assertEquals(getDomain(DOUBLE, 0, doubleColumnStats(null, null, null)), none(DOUBLE));
assertEquals(getDomain(DOUBLE, 0, doubleColumnStats(0L, null, null)), none(DOUBLE));
assertEquals(getDomain(DOUBLE, 0, doubleColumnStats(0L, 42.24, 42.24)), none(DOUBLE));
assertEquals(getDomain(DOUBLE, 10, doubleColumnStats(0L, null, null)), onlyNull(DOUBLE));
assertEquals(getDomain(DOUBLE, 10, doubleColumnStats(10L, null, null)), notNull(DOUBLE));
assertEquals(getDomain(DOUBLE, 10, doubleColumnStats(10L, 42.24, 42.24)), singleValue(DOUBLE, 42.24));
assertEquals(getDomain(DOUBLE, 10, doubleColumnStats(10L, 3.3, 42.24)), create(ValueSet.ofRanges(range(DOUBLE, 3.3, true, 42.24, true)), false));
assertEquals(getDomain(DOUBLE, 10, doubleColumnStats(10L, null, 42.24)), create(ValueSet.ofRanges(lessThanOrEqual(DOUBLE, 42.24)), false));
assertEquals(getDomain(DOUBLE, 10, doubleColumnStats(10L, 3.3, null)), create(ValueSet.ofRanges(greaterThanOrEqual(DOUBLE, 3.3)), false));
assertEquals(getDomain(DOUBLE, 10, doubleColumnStats(5L, 3.3, 42.24)), create(ValueSet.ofRanges(range(DOUBLE, 3.3, true, 42.24, true)), true));
assertEquals(getDomain(DOUBLE, 10, doubleColumnStats(5L, null, 42.24)), create(ValueSet.ofRanges(lessThanOrEqual(DOUBLE, 42.24)), true));
assertEquals(getDomain(DOUBLE, 10, doubleColumnStats(5L, 3.3, null)), create(ValueSet.ofRanges(greaterThanOrEqual(DOUBLE, 3.3)), true));
}
内容来源于网络,如有侵权,请联系作者删除!