本文整理了Java中com.facebook.presto.spi.predicate.Range.<init>
方法的一些代码示例,展示了Range.<init>
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.<init>
方法的具体详情如下:
包路径:com.facebook.presto.spi.predicate.Range
类名称:Range
方法名:<init>
暂无
代码示例来源:origin: prestodb/presto
public static Range greaterThanOrEqual(Type type, Object low)
{
return new Range(Marker.exactly(type, low), Marker.upperUnbounded(type));
}
代码示例来源: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 greaterThan(Type type, Object low)
{
return new Range(Marker.above(type, low), Marker.upperUnbounded(type));
}
代码示例来源: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
public static Range all(Type type)
{
return new Range(Marker.lowerUnbounded(type), Marker.upperUnbounded(type));
}
代码示例来源: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 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(expectedExceptions = IllegalArgumentException.class)
public void testInvertedBounds()
{
new Range(Marker.exactly(BIGINT, 1L), Marker.exactly(BIGINT, 0L));
}
代码示例来源:origin: prestodb/presto
public Range intersect(Range other)
{
checkTypeCompatibility(other);
if (!this.overlaps(other)) {
throw new IllegalArgumentException("Cannot intersect non-overlapping ranges");
}
Marker lowMarker = Marker.max(low, other.getLow());
Marker highMarker = Marker.min(high, other.getHigh());
return new Range(lowMarker, highMarker);
}
代码示例来源:origin: prestodb/presto
@Test(expectedExceptions = IllegalArgumentException.class)
public void testLowerUnboundedOnly()
{
new Range(Marker.lowerUnbounded(BIGINT), Marker.lowerUnbounded(BIGINT));
}
代码示例来源:origin: prestodb/presto
@Test(expectedExceptions = IllegalArgumentException.class)
public void testUpperUnboundedOnly()
{
new Range(Marker.upperUnbounded(BIGINT), Marker.upperUnbounded(BIGINT));
}
代码示例来源:origin: prestodb/presto
public Range span(Range other)
{
checkTypeCompatibility(other);
Marker lowMarker = Marker.min(low, other.getLow());
Marker highMarker = Marker.max(high, other.getHigh());
return new Range(lowMarker, highMarker);
}
代码示例来源: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
@Override
public SortedRangeSet complement()
{
Builder builder = new Builder(type);
if (lowIndexedRanges.isEmpty()) {
return builder.add(Range.all(type)).build();
}
Iterator<Range> rangeIterator = lowIndexedRanges.values().iterator();
Range firstRange = rangeIterator.next();
if (!firstRange.getLow().isLowerUnbounded()) {
builder.add(new Range(Marker.lowerUnbounded(type), firstRange.getLow().lesserAdjacent()));
}
Range previousRange = firstRange;
while (rangeIterator.hasNext()) {
Range currentRange = rangeIterator.next();
Marker lowMarker = previousRange.getHigh().greaterAdjacent();
Marker highMarker = currentRange.getLow().lesserAdjacent();
builder.add(new Range(lowMarker, highMarker));
previousRange = currentRange;
}
Range lastRange = previousRange;
if (!lastRange.getHigh().isUpperUnbounded()) {
builder.add(new Range(lastRange.getHigh().greaterAdjacent(), Marker.upperUnbounded(type)));
}
return builder.build();
}
代码示例来源:origin: stackoverflow.com
public final class RangeFactory {
public static Iterable<Integer> range(int a, int b) {
return new Range(a, b);
}
}
代码示例来源:origin: stackoverflow.com
public static Range range(int max) {
return new Range(max);
}
代码示例来源:origin: stackoverflow.com
for (int i : new Range(10)) {...} // i = 0,1,2,3,4,5,6,7,8,9
for (int i : new Range(4,10)) {...} // i = 4,5,6,7,8,9
for (int i : new Range(0,10,2)) {...} // i = 0,2,4,6,8
Range range = new Range(0,10,2);
range.toList(); // [0,2,4,6,8]
代码示例来源:origin: stackoverflow.com
public class TestRange {
public static void main(String[] args) {
for (int i : new Range(1, 10)) {
System.out.println(i);
}
}
}
代码示例来源:origin: stackoverflow.com
Range range5 = new Range(5);
for (int i : range5) {
System.out.println(i);
}
for (int i : range5) {
System.out.println(i);
}
内容来源于网络,如有侵权,请联系作者删除!