本文整理了Java中io.prestosql.spi.predicate.Range.lessThan
方法的一些代码示例,展示了Range.lessThan
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.lessThan
方法的具体详情如下:
包路径:io.prestosql.spi.predicate.Range
类名称:Range
方法名:lessThan
暂无
代码示例来源:origin: io.prestosql/presto-spi
@Test
public void testGetSingleValue()
{
assertEquals(Range.equal(BIGINT, 0L).getSingleValue(), 0L);
try {
Range.lessThan(BIGINT, 0L).getSingleValue();
fail();
}
catch (IllegalStateException e) {
}
}
代码示例来源: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: 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 testGetSingleValue()
{
assertEquals(Range.equal(BIGINT, 0L).getSingleValue(), 0L);
try {
Range.lessThan(BIGINT, 0L).getSingleValue();
fail();
}
catch (IllegalStateException e) {
}
}
代码示例来源: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 testBuildQueryOr()
{
TupleDomain<ColumnHandle> tupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(
COL1, Domain.create(ValueSet.ofRanges(lessThan(BIGINT, 100L), greaterThan(BIGINT, 200L)), false)));
Document query = MongoSession.buildQuery(tupleDomain);
Document expected = new Document("$or", asList(
new Document(COL1.getName(), new Document("$lt", 100L)),
new Document(COL1.getName(), new Document("$gt", 200L))));
assertEquals(query, expected);
}
代码示例来源: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: io.prestosql/presto-spi
@Test
public void testExceptionalIntersect()
{
try {
Range.greaterThan(BIGINT, 2L).intersect(Range.lessThan(BIGINT, 2L));
fail();
}
catch (IllegalArgumentException e) {
}
try {
Range.range(BIGINT, 1L, true, 3L, false).intersect(Range.range(BIGINT, 3L, true, 10L, false));
fail();
}
catch (IllegalArgumentException e) {
}
}
代码示例来源:origin: prestosql/presto
@Test
public void testExceptionalIntersect()
{
try {
Range.greaterThan(BIGINT, 2L).intersect(Range.lessThan(BIGINT, 2L));
fail();
}
catch (IllegalArgumentException e) {
}
try {
Range.range(BIGINT, 1L, true, 3L, false).intersect(Range.range(BIGINT, 3L, true, 10L, false));
fail();
}
catch (IllegalArgumentException e) {
}
}
代码示例来源:origin: prestosql/presto
@Test
public void testLessThanRange()
{
Range range = Range.lessThan(BIGINT, 1L);
assertEquals(range.getLow(), Marker.lowerUnbounded(BIGINT));
assertEquals(range.getHigh(), Marker.below(BIGINT, 1L));
assertFalse(range.isSingleValue());
assertFalse(range.isAll());
assertEquals(range.getType(), BIGINT);
assertTrue(range.includes(Marker.lowerUnbounded(BIGINT)));
assertFalse(range.includes(Marker.exactly(BIGINT, 1L)));
assertTrue(range.includes(Marker.exactly(BIGINT, 0L)));
assertFalse(range.includes(Marker.upperUnbounded(BIGINT)));
}
代码示例来源:origin: io.prestosql/presto-spi
@Test
public void testLessThanRange()
{
Range range = Range.lessThan(BIGINT, 1L);
assertEquals(range.getLow(), Marker.lowerUnbounded(BIGINT));
assertEquals(range.getHigh(), Marker.below(BIGINT, 1L));
assertFalse(range.isSingleValue());
assertFalse(range.isAll());
assertEquals(range.getType(), BIGINT);
assertTrue(range.includes(Marker.lowerUnbounded(BIGINT)));
assertFalse(range.includes(Marker.exactly(BIGINT, 1L)));
assertTrue(range.includes(Marker.exactly(BIGINT, 0L)));
assertFalse(range.includes(Marker.upperUnbounded(BIGINT)));
}
代码示例来源:origin: io.prestosql/presto-spi
@Test
public void testSingleValue()
{
SortedRangeSet rangeSet = SortedRangeSet.of(BIGINT, 10L);
SortedRangeSet complement = SortedRangeSet.of(Range.greaterThan(BIGINT, 10L), Range.lessThan(BIGINT, 10L));
assertEquals(rangeSet.getType(), BIGINT);
assertFalse(rangeSet.isNone());
assertFalse(rangeSet.isAll());
assertTrue(rangeSet.isSingleValue());
assertTrue(Iterables.elementsEqual(rangeSet.getOrderedRanges(), ImmutableList.of(Range.equal(BIGINT, 10L))));
assertEquals(rangeSet.getRangeCount(), 1);
assertEquals(rangeSet.complement(), complement);
assertFalse(rangeSet.includesMarker(Marker.lowerUnbounded(BIGINT)));
assertTrue(rangeSet.includesMarker(Marker.exactly(BIGINT, 10L)));
assertFalse(rangeSet.includesMarker(Marker.exactly(BIGINT, 9L)));
assertFalse(rangeSet.includesMarker(Marker.upperUnbounded(BIGINT)));
}
代码示例来源:origin: io.prestosql/presto-hive
@Test
public void testNotPushDoublePredicates()
{
IonSqlQueryBuilder queryBuilder = new IonSqlQueryBuilder(new TypeRegistry());
List<HiveColumnHandle> columns = ImmutableList.of(
new HiveColumnHandle("quantity", HIVE_INT, parseTypeSignature(INTEGER), 0, REGULAR, Optional.empty()),
new HiveColumnHandle("extendedprice", HIVE_DOUBLE, parseTypeSignature(StandardTypes.DOUBLE), 1, REGULAR, Optional.empty()),
new HiveColumnHandle("discount", HIVE_DOUBLE, parseTypeSignature(StandardTypes.DOUBLE), 2, REGULAR, Optional.empty()));
TupleDomain<HiveColumnHandle> tupleDomain = withColumnDomains(
ImmutableMap.of(
columns.get(0), Domain.create(ofRanges(Range.lessThan(BIGINT, 50L)), false),
columns.get(1), Domain.create(ofRanges(Range.equal(DOUBLE, 0.05)), false),
columns.get(2), Domain.create(ofRanges(Range.range(DOUBLE, 0.0, true, 0.02, true)), false)));
assertEquals("SELECT s._1, s._2, s._3 FROM S3Object s WHERE ((case s._1 when '' then null else CAST(s._1 AS INT) end < 50))",
queryBuilder.buildSql(columns, tupleDomain));
}
}
代码示例来源:origin: prestosql/presto
@Test
public void testNotPushDoublePredicates()
{
IonSqlQueryBuilder queryBuilder = new IonSqlQueryBuilder(new TypeRegistry());
List<HiveColumnHandle> columns = ImmutableList.of(
new HiveColumnHandle("quantity", HIVE_INT, parseTypeSignature(INTEGER), 0, REGULAR, Optional.empty()),
new HiveColumnHandle("extendedprice", HIVE_DOUBLE, parseTypeSignature(StandardTypes.DOUBLE), 1, REGULAR, Optional.empty()),
new HiveColumnHandle("discount", HIVE_DOUBLE, parseTypeSignature(StandardTypes.DOUBLE), 2, REGULAR, Optional.empty()));
TupleDomain<HiveColumnHandle> tupleDomain = withColumnDomains(
ImmutableMap.of(
columns.get(0), Domain.create(ofRanges(Range.lessThan(BIGINT, 50L)), false),
columns.get(1), Domain.create(ofRanges(Range.equal(DOUBLE, 0.05)), false),
columns.get(2), Domain.create(ofRanges(Range.range(DOUBLE, 0.0, true, 0.02, true)), false)));
assertEquals("SELECT s._1, s._2, s._3 FROM S3Object s WHERE ((case s._1 when '' then null else CAST(s._1 AS INT) end < 50))",
queryBuilder.buildSql(columns, tupleDomain));
}
}
代码示例来源: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 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()
{
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 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 testFromNotPredicate()
{
assertUnsupportedPredicate(not(and(equal(C_BIGINT, bigintLiteral(1L)), unprocessableExpression1(C_BIGINT))));
assertUnsupportedPredicate(not(unprocessableExpression1(C_BIGINT)));
assertPredicateIsAlwaysFalse(not(TRUE_LITERAL));
assertPredicateTranslates(
not(equal(C_BIGINT, bigintLiteral(1L))),
withColumnDomains(ImmutableMap.of(C_BIGINT, Domain.create(ValueSet.ofRanges(Range.lessThan(BIGINT, 1L), Range.greaterThan(BIGINT, 1L)), false))));
}
代码示例来源:origin: io.prestosql/presto-main
@Test
public void testFromNotPredicate()
{
assertUnsupportedPredicate(not(and(equal(C_BIGINT, bigintLiteral(1L)), unprocessableExpression1(C_BIGINT))));
assertUnsupportedPredicate(not(unprocessableExpression1(C_BIGINT)));
assertPredicateIsAlwaysFalse(not(TRUE_LITERAL));
assertPredicateTranslates(
not(equal(C_BIGINT, bigintLiteral(1L))),
withColumnDomains(ImmutableMap.of(C_BIGINT, Domain.create(ValueSet.ofRanges(Range.lessThan(BIGINT, 1L), Range.greaterThan(BIGINT, 1L)), false))));
}
内容来源于网络,如有侵权,请联系作者删除!