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

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

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

Marker.below介绍

暂无

代码示例

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

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

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

@Setup(Level.Iteration)
  public void init()
  {
    ranges = new ArrayList<>();
    int factor = 0;
    for (int i = 0; i < 10000; i++) {
      long from = ThreadLocalRandom.current().nextLong(100) + factor * 100;
      long to = ThreadLocalRandom.current().nextLong(100) + (factor + 1) * 100;
      factor++;
      ranges.add(new Range(Marker.above(BIGINT, from), Marker.below(BIGINT, to)));
    }
  }
}

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

assertEquals(marker, mapper.readValue(mapper.writeValueAsString(marker), Marker.class));
marker = Marker.below(DOUBLE, 0.123);
assertEquals(marker, mapper.readValue(mapper.writeValueAsString(marker), Marker.class));

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

.put(Marker.lowerUnbounded(BIGINT), -1000)
    .put(Marker.above(BIGINT, 0L), -100)
    .put(Marker.below(BIGINT, 1L), -1)
    .put(Marker.exactly(BIGINT, 1L), 0)
    .put(Marker.above(BIGINT, 1L), 1)
    .put(Marker.below(BIGINT, 2L), 100)
    .put(Marker.upperUnbounded(BIGINT), 1000)
    .build();
assertEquals(Marker.below(BIGINT, 1L).greaterAdjacent(), Marker.exactly(BIGINT, 1L));
assertEquals(Marker.exactly(BIGINT, 1L).greaterAdjacent(), Marker.above(BIGINT, 1L));
assertEquals(Marker.above(BIGINT, 1L).lesserAdjacent(), Marker.exactly(BIGINT, 1L));
assertEquals(Marker.exactly(BIGINT, 1L).lesserAdjacent(), Marker.below(BIGINT, 1L));
  Marker.below(BIGINT, 1L).lesserAdjacent();
  fail();

代码示例来源:origin: com.facebook.presto/presto-spi

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

代码示例来源:origin: com.facebook.presto/presto-spi

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

相关文章