com.facebook.presto.spi.predicate.Range.lessThanOrEqual()方法的使用及代码示例

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

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

Range.lessThanOrEqual介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

private static boolean isEqualRange(TupleDomain<Symbol> tupleDomain, Symbol symbol, long upperBound)
{
  if (tupleDomain.isNone()) {
    return false;
  }
  Domain domain = tupleDomain.getDomains().get().get(symbol);
  return domain.getValues().equals(ValueSet.ofRanges(Range.lessThanOrEqual(domain.getType(), upperBound)));
}

代码示例来源:origin: prestodb/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: prestodb/presto

private static <F, T extends Comparable<T>> Domain createDomain(Type type,
      boolean hasNullValue,
      ParquetRangeStatistics<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: prestodb/presto

assertEquals(range, mapper.readValue(mapper.writeValueAsString(range), Range.class));
range = Range.lessThanOrEqual(DOUBLE, Double.MAX_VALUE);
assertEquals(range, mapper.readValue(mapper.writeValueAsString(range), Range.class));

代码示例来源: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: prestodb/presto

@Test
public void testLessThanOrEqualRange()
{
  Range range = Range.lessThanOrEqual(BIGINT, 1L);
  assertEquals(range.getLow(), Marker.lowerUnbounded(BIGINT));
  assertEquals(range.getHigh(), Marker.exactly(BIGINT, 1L));
  assertFalse(range.isSingleValue());
  assertFalse(range.isAll());
  assertEquals(range.getType(), BIGINT);
  assertTrue(range.includes(Marker.lowerUnbounded(BIGINT)));
  assertFalse(range.includes(Marker.exactly(BIGINT, 2L)));
  assertTrue(range.includes(Marker.exactly(BIGINT, 1L)));
  assertTrue(range.includes(Marker.exactly(BIGINT, 0L)));
  assertFalse(range.includes(Marker.upperUnbounded(BIGINT)));
}

代码示例来源:origin: prestodb/presto

@Test
public void testRoundTrip()
{
  TupleDomain<Symbol> tupleDomain = withColumnDomains(ImmutableMap.<Symbol, Domain>builder()
      .put(C_BIGINT, Domain.singleValue(BIGINT, 1L))
      .put(C_DOUBLE, Domain.onlyNull(DOUBLE))
      .put(C_VARCHAR, Domain.notNull(VARCHAR))
      .put(C_BOOLEAN, Domain.singleValue(BOOLEAN, true))
      .put(C_BIGINT_1, Domain.singleValue(BIGINT, 2L))
      .put(C_DOUBLE_1, Domain.create(ValueSet.ofRanges(Range.lessThanOrEqual(DOUBLE, 1.1), Range.equal(DOUBLE, 2.0), Range.range(DOUBLE, 3.0, false, 3.5, true)), true))
      .put(C_VARCHAR_1, Domain.create(ValueSet.ofRanges(Range.lessThanOrEqual(VARCHAR, utf8Slice("2013-01-01")), Range.greaterThan(VARCHAR, utf8Slice("2013-10-01"))), false))
      .put(C_TIMESTAMP, Domain.singleValue(TIMESTAMP, TIMESTAMP_VALUE))
      .put(C_DATE, Domain.singleValue(DATE, DATE_VALUE))
      .put(C_COLOR, Domain.singleValue(COLOR, COLOR_VALUE_1))
      .put(C_HYPER_LOG_LOG, Domain.notNull(HYPER_LOG_LOG))
      .build());
  assertPredicateTranslates(toPredicate(tupleDomain), tupleDomain);
}

代码示例来源:origin: prestodb/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: prestodb/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: prestodb/presto

@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: prestodb/presto

Range.lessThanOrEqual(BIGINT, 0L),
Range.range(BIGINT, 2L, true, 4L, false),
Range.range(BIGINT, 4L, true, 6L, false),
Range.lessThanOrEqual(BIGINT, 0L),
Range.range(BIGINT, 1L, false, 6L, false),
Range.greaterThan(BIGINT, 9L));

代码示例来源:origin: prestodb/presto

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

代码示例来源:origin: prestodb/presto

@Test
public void testBigint()
{
  assertEquals(getDomain(BIGINT, 0, null), none(BIGINT));
  assertEquals(getDomain(BIGINT, 10, null), all(BIGINT));
  assertEquals(getDomain(BIGINT, 0, integerColumnStats(null, null, null)), none(BIGINT));
  assertEquals(getDomain(BIGINT, 0, integerColumnStats(0L, null, null)), none(BIGINT));
  assertEquals(getDomain(BIGINT, 0, integerColumnStats(0L, 100L, 100L)), none(BIGINT));
  assertEquals(getDomain(BIGINT, 10, integerColumnStats(0L, null, null)), onlyNull(BIGINT));
  assertEquals(getDomain(BIGINT, 10, integerColumnStats(10L, null, null)), notNull(BIGINT));
  assertEquals(getDomain(BIGINT, 10, integerColumnStats(10L, 100L, 100L)), singleValue(BIGINT, 100L));
  assertEquals(getDomain(BIGINT, 10, integerColumnStats(10L, 0L, 100L)), create(ValueSet.ofRanges(range(BIGINT, 0L, true, 100L, true)), false));
  assertEquals(getDomain(BIGINT, 10, integerColumnStats(10L, null, 100L)), create(ValueSet.ofRanges(lessThanOrEqual(BIGINT, 100L)), false));
  assertEquals(getDomain(BIGINT, 10, integerColumnStats(10L, 0L, null)), create(ValueSet.ofRanges(greaterThanOrEqual(BIGINT, 0L)), false));
  assertEquals(getDomain(BIGINT, 10, integerColumnStats(5L, 0L, 100L)), create(ValueSet.ofRanges(range(BIGINT, 0L, true, 100L, true)), true));
  assertEquals(getDomain(BIGINT, 10, integerColumnStats(5L, null, 100L)), create(ValueSet.ofRanges(lessThanOrEqual(BIGINT, 100L)), true));
  assertEquals(getDomain(BIGINT, 10, integerColumnStats(5L, 0L, null)), create(ValueSet.ofRanges(greaterThanOrEqual(BIGINT, 0L)), true));
}

代码示例来源:origin: prestodb/presto

@Test
public void testDate()
{
  assertEquals(getDomain(DATE, 0, null), none(DATE));
  assertEquals(getDomain(DATE, 10, null), all(DATE));
  assertEquals(getDomain(DATE, 0, dateColumnStats(null, null, null)), none(DATE));
  assertEquals(getDomain(DATE, 0, dateColumnStats(0L, null, null)), none(DATE));
  assertEquals(getDomain(DATE, 0, dateColumnStats(0L, 100, 100)), none(DATE));
  assertEquals(getDomain(DATE, 10, dateColumnStats(0L, null, null)), onlyNull(DATE));
  assertEquals(getDomain(DATE, 10, dateColumnStats(10L, null, null)), notNull(DATE));
  assertEquals(getDomain(DATE, 10, dateColumnStats(10L, 100, 100)), singleValue(DATE, 100L));
  assertEquals(getDomain(DATE, 10, dateColumnStats(10L, 0, 100)), create(ValueSet.ofRanges(range(DATE, 0L, true, 100L, true)), false));
  assertEquals(getDomain(DATE, 10, dateColumnStats(10L, null, 100)), create(ValueSet.ofRanges(lessThanOrEqual(DATE, 100L)), false));
  assertEquals(getDomain(DATE, 10, dateColumnStats(10L, 0, null)), create(ValueSet.ofRanges(greaterThanOrEqual(DATE, 0L)), false));
  assertEquals(getDomain(DATE, 10, dateColumnStats(5L, 0, 100)), create(ValueSet.ofRanges(range(DATE, 0L, true, 100L, true)), true));
  assertEquals(getDomain(DATE, 10, dateColumnStats(5L, null, 100)), create(ValueSet.ofRanges(lessThanOrEqual(DATE, 100L)), true));
  assertEquals(getDomain(DATE, 10, dateColumnStats(5L, 0, null)), create(ValueSet.ofRanges(greaterThanOrEqual(DATE, 0L)), true));
}

代码示例来源:origin: prestodb/presto

@Test
public void testString()
{
  assertEquals(getDomain(VARCHAR, 0, null), none(VARCHAR));
  assertEquals(getDomain(VARCHAR, 10, null), all(VARCHAR));
  assertEquals(getDomain(VARCHAR, 0, stringColumnStats(null, null, null)), none(VARCHAR));
  assertEquals(getDomain(VARCHAR, 0, stringColumnStats(0L, null, null)), none(VARCHAR));
  assertEquals(getDomain(VARCHAR, 0, stringColumnStats(0L, "taco", "taco")), none(VARCHAR));
  assertEquals(getDomain(VARCHAR, 10, stringColumnStats(0L, null, null)), onlyNull(VARCHAR));
  assertEquals(getDomain(VARCHAR, 10, stringColumnStats(10L, null, null)), notNull(VARCHAR));
  assertEquals(getDomain(VARCHAR, 10, stringColumnStats(10L, "taco", "taco")), singleValue(VARCHAR, utf8Slice("taco")));
  assertEquals(getDomain(VARCHAR, 10, stringColumnStats(10L, "apple", "taco")), create(ValueSet.ofRanges(range(VARCHAR, utf8Slice("apple"), true, utf8Slice("taco"), true)), false));
  assertEquals(getDomain(VARCHAR, 10, stringColumnStats(10L, null, "taco")), create(ValueSet.ofRanges(lessThanOrEqual(VARCHAR, utf8Slice("taco"))), false));
  assertEquals(getDomain(VARCHAR, 10, stringColumnStats(10L, "apple", null)), create(ValueSet.ofRanges(greaterThanOrEqual(VARCHAR, utf8Slice("apple"))), false));
  assertEquals(getDomain(VARCHAR, 10, stringColumnStats(5L, "apple", "taco")), create(ValueSet.ofRanges(range(VARCHAR, utf8Slice("apple"), true, utf8Slice("taco"), true)), true));
  assertEquals(getDomain(VARCHAR, 10, stringColumnStats(5L, null, "taco")), create(ValueSet.ofRanges(lessThanOrEqual(VARCHAR, utf8Slice("taco"))), true));
  assertEquals(getDomain(VARCHAR, 10, stringColumnStats(5L, "apple", null)), create(ValueSet.ofRanges(greaterThanOrEqual(VARCHAR, utf8Slice("apple"))), true));
}

代码示例来源:origin: prestodb/presto

private static Domain extractOrderableDomain(ComparisonExpression.Operator comparisonOperator, Type type, Object value, boolean complement)
{
  checkArgument(value != null);
  switch (comparisonOperator) {
    case EQUAL:
      return Domain.create(complementIfNecessary(ValueSet.ofRanges(Range.equal(type, value)), complement), false);
    case GREATER_THAN:
      return Domain.create(complementIfNecessary(ValueSet.ofRanges(Range.greaterThan(type, value)), complement), false);
    case GREATER_THAN_OR_EQUAL:
      return Domain.create(complementIfNecessary(ValueSet.ofRanges(Range.greaterThanOrEqual(type, value)), complement), false);
    case LESS_THAN:
      return Domain.create(complementIfNecessary(ValueSet.ofRanges(Range.lessThan(type, value)), complement), false);
    case LESS_THAN_OR_EQUAL:
      return Domain.create(complementIfNecessary(ValueSet.ofRanges(Range.lessThanOrEqual(type, value)), complement), false);
    case NOT_EQUAL:
      return Domain.create(complementIfNecessary(ValueSet.ofRanges(Range.lessThan(type, value), Range.greaterThan(type, value)), complement), false);
    case IS_DISTINCT_FROM:
      // Need to potential complement the whole domain for IS_DISTINCT_FROM since it is null-aware
      return complementIfNecessary(Domain.create(ValueSet.ofRanges(Range.lessThan(type, value), Range.greaterThan(type, value)), true), complement);
    default:
      throw new AssertionError("Unhandled operator: " + comparisonOperator);
  }
}

代码示例来源:origin: prestodb/presto

@Test
public void testChar()
{
  assertEquals(getDomain(CHAR, 0, null), none(CHAR));
  assertEquals(getDomain(CHAR, 10, null), all(CHAR));
  assertEquals(getDomain(CHAR, 0, stringColumnStats(null, null, null)), none(CHAR));
  assertEquals(getDomain(CHAR, 0, stringColumnStats(0L, null, null)), none(CHAR));
  assertEquals(getDomain(CHAR, 0, stringColumnStats(0L, "taco      ", "taco      ")), none(CHAR));
  assertEquals(getDomain(CHAR, 0, stringColumnStats(0L, "taco", "taco      ")), none(CHAR));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(0L, null, null)), onlyNull(CHAR));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(10L, null, null)), notNull(CHAR));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(10L, "taco      ", "taco      ")), singleValue(CHAR, utf8Slice("taco")));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(10L, "taco", "taco      ")), singleValue(CHAR, utf8Slice("taco")));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(10L, "apple     ", "taco      ")), create(ValueSet.ofRanges(range(CHAR, utf8Slice("apple"), true, utf8Slice("taco"), true)), false));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(10L, "apple     ", "taco")), create(ValueSet.ofRanges(range(CHAR, utf8Slice("apple"), true, utf8Slice("taco"), true)), false));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(10L, null, "taco      ")), create(ValueSet.ofRanges(lessThanOrEqual(CHAR, utf8Slice("taco"))), false));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(10L, null, "taco")), create(ValueSet.ofRanges(lessThanOrEqual(CHAR, utf8Slice("taco"))), false));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(10L, "apple     ", null)), create(ValueSet.ofRanges(greaterThanOrEqual(CHAR, utf8Slice("apple"))), false));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(10L, "apple", null)), create(ValueSet.ofRanges(greaterThanOrEqual(CHAR, utf8Slice("apple"))), false));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(5L, "apple     ", "taco      ")), create(ValueSet.ofRanges(range(CHAR, utf8Slice("apple"), true, utf8Slice("taco"), true)), true));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(5L, "apple     ", "taco")), create(ValueSet.ofRanges(range(CHAR, utf8Slice("apple"), true, utf8Slice("taco"), true)), true));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(5L, null, "taco      ")), create(ValueSet.ofRanges(lessThanOrEqual(CHAR, utf8Slice("taco"))), true));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(5L, null, "taco")), create(ValueSet.ofRanges(lessThanOrEqual(CHAR, utf8Slice("taco"))), true));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(5L, "apple     ", null)), create(ValueSet.ofRanges(greaterThanOrEqual(CHAR, utf8Slice("apple"))), true));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(5L, "apple", null)), create(ValueSet.ofRanges(greaterThanOrEqual(CHAR, utf8Slice("apple"))), true));
  assertEquals(getDomain(CHAR, 10, stringColumnStats(10L, "\0 ", " ")), create(ValueSet.ofRanges(range(CHAR, utf8Slice("\0"), true, utf8Slice(""), true)), false));
}

代码示例来源:origin: prestodb/presto

SortedRangeSet.of(Range.lessThanOrEqual(BIGINT, 0L))),
SortedRangeSet.of(Range.equal(BIGINT, 0L)));
    SortedRangeSet.of(Range.lessThanOrEqual(BIGINT, 1L))),
SortedRangeSet.of(Range.range(BIGINT, -1L, true, 1L, true)));

代码示例来源:origin: prestodb/presto

withColumnDomains(ImmutableMap.of(C_BIGINT, Domain.create(ValueSet.ofRanges(Range.lessThanOrEqual(BIGINT, 2L)), false))));

代码示例来源:origin: prestodb/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());
}

相关文章