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

x33g5p2x  于2022-01-25 转载在 其他  
字(9.4k)|赞(0)|评价(0)|浏览(142)

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

Marker.exactly介绍

暂无

代码示例

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

public static Range equal(Type type, Object value)
{
  return new Range(Marker.exactly(type, value), Marker.exactly(type, value));
}

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

@Override
public boolean containsValue(Object value)
{
  return includesMarker(Marker.exactly(type, value));
}

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

public static Range range(Type type, Object low, boolean lowInclusive, Object high, boolean highInclusive)
{
  Marker lowMarker = lowInclusive ? Marker.exactly(type, low) : Marker.above(type, low);
  Marker highMarker = highInclusive ? Marker.exactly(type, high) : Marker.below(type, high);
  return new Range(lowMarker, highMarker);
}

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

public static Range lessThanOrEqual(Type type, Object high)
{
  return new Range(Marker.lowerUnbounded(type), Marker.exactly(type, high));
}

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

public static Range greaterThanOrEqual(Type type, Object low)
{
  return new Range(Marker.exactly(type, low), Marker.upperUnbounded(type));
}

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

@Test(expectedExceptions = IllegalArgumentException.class)
public void testInvertedBounds()
{
  new Range(Marker.exactly(BIGINT, 1L), Marker.exactly(BIGINT, 0L));
}

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

@SuppressWarnings({"unchecked", "rawtypes"})
@Test(expectedExceptions = IllegalArgumentException.class)
public void testMismatchedTypes()
{
  // NEVER DO THIS
  new Range(Marker.exactly(BIGINT, 1L), Marker.exactly(VARCHAR, utf8Slice("a")));
}

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

@Test
public void testEqualRange()
{
  Range range = Range.equal(BIGINT, 1L);
  assertEquals(range.getLow(), Marker.exactly(BIGINT, 1L));
  assertEquals(range.getHigh(), Marker.exactly(BIGINT, 1L));
  assertTrue(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)));
  assertFalse(range.includes(Marker.exactly(BIGINT, 2L)));
  assertFalse(range.includes(Marker.upperUnbounded(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 testRange()
{
  Range range = Range.range(BIGINT, 0L, false, 2L, true);
  assertEquals(range.getLow(), Marker.above(BIGINT, 0L));
  assertEquals(range.getHigh(), Marker.exactly(BIGINT, 2L));
  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)));
  assertFalse(range.includes(Marker.exactly(BIGINT, 3L)));
  assertFalse(range.includes(Marker.upperUnbounded(BIGINT)));
}

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

@Test
public void testTypes()
{
  assertEquals(Marker.lowerUnbounded(BIGINT).getType(), BIGINT);
  assertEquals(Marker.below(BIGINT, 1L).getType(), BIGINT);
  assertEquals(Marker.exactly(BIGINT, 1L).getType(), BIGINT);
  assertEquals(Marker.above(BIGINT, 1L).getType(), BIGINT);
  assertEquals(Marker.upperUnbounded(BIGINT).getType(), BIGINT);
}

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

@Test
public void testGreaterThanRange()
{
  Range range = Range.greaterThan(BIGINT, 1L);
  assertEquals(range.getLow(), Marker.above(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, 1L)));
  assertTrue(range.includes(Marker.exactly(BIGINT, 2L)));
  assertTrue(range.includes(Marker.upperUnbounded(BIGINT)));
}

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

@Test
public void testComparisons()
{
  ImmutableList<Marker> markers = ImmutableList.of(
      Marker.lowerUnbounded(BIGINT),
      Marker.above(BIGINT, 0L),
      Marker.below(BIGINT, 1L),
      Marker.exactly(BIGINT, 1L),
      Marker.above(BIGINT, 1L),
      Marker.below(BIGINT, 2L),
      Marker.upperUnbounded(BIGINT));
  assertTrue(Ordering.natural().isStrictlyOrdered(markers));
  // Compare every marker with every other marker
  // Since the markers are strictly ordered, the value of the comparisons should be equivalent to the comparisons
  // of their indexes.
  for (int i = 0; i < markers.size(); i++) {
    for (int j = 0; j < markers.size(); j++) {
      assertTrue(markers.get(i).compareTo(markers.get(j)) == Integer.compare(i, j));
    }
  }
}

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

@Test
public void testEmptySet()
{
  SortedRangeSet rangeSet = SortedRangeSet.none(BIGINT);
  assertEquals(rangeSet.getType(), BIGINT);
  assertTrue(rangeSet.isNone());
  assertFalse(rangeSet.isAll());
  assertFalse(rangeSet.isSingleValue());
  assertTrue(Iterables.isEmpty(rangeSet.getOrderedRanges()));
  assertEquals(rangeSet.getRangeCount(), 0);
  assertEquals(rangeSet.complement(), SortedRangeSet.all(BIGINT));
  assertFalse(rangeSet.includesMarker(Marker.lowerUnbounded(BIGINT)));
  assertFalse(rangeSet.includesMarker(Marker.exactly(BIGINT, 0L)));
  assertFalse(rangeSet.includesMarker(Marker.upperUnbounded(BIGINT)));
}

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

@Test
public void testEntireSet()
{
  SortedRangeSet rangeSet = SortedRangeSet.all(BIGINT);
  assertEquals(rangeSet.getType(), BIGINT);
  assertFalse(rangeSet.isNone());
  assertTrue(rangeSet.isAll());
  assertFalse(rangeSet.isSingleValue());
  assertEquals(rangeSet.getRangeCount(), 1);
  assertEquals(rangeSet.complement(), SortedRangeSet.none(BIGINT));
  assertTrue(rangeSet.includesMarker(Marker.lowerUnbounded(BIGINT)));
  assertTrue(rangeSet.includesMarker(Marker.exactly(BIGINT, 0L)));
  assertTrue(rangeSet.includesMarker(Marker.upperUnbounded(BIGINT)));
}

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

@Test
public void testUnbounded()
{
  assertTrue(Marker.lowerUnbounded(BIGINT).isLowerUnbounded());
  assertFalse(Marker.lowerUnbounded(BIGINT).isUpperUnbounded());
  assertTrue(Marker.upperUnbounded(BIGINT).isUpperUnbounded());
  assertFalse(Marker.upperUnbounded(BIGINT).isLowerUnbounded());
  assertFalse(Marker.below(BIGINT, 1L).isLowerUnbounded());
  assertFalse(Marker.below(BIGINT, 1L).isUpperUnbounded());
  assertFalse(Marker.exactly(BIGINT, 1L).isLowerUnbounded());
  assertFalse(Marker.exactly(BIGINT, 1L).isUpperUnbounded());
  assertFalse(Marker.above(BIGINT, 1L).isLowerUnbounded());
  assertFalse(Marker.above(BIGINT, 1L).isUpperUnbounded());
}

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

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

相关文章