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

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

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

Marker.getBound介绍

暂无

代码示例

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

public boolean isSingleValue()
{
  return low.getBound() == Marker.Bound.EXACTLY && low.equals(high);
}

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

public String toString(ConnectorSession session)
  {
    StringBuilder buffer = new StringBuilder();
    if (isSingleValue()) {
      buffer.append('[').append(low.getPrintableValue(session)).append(']');
    }
    else {
      buffer.append((low.getBound() == Marker.Bound.EXACTLY) ? '[' : '(');
      buffer.append(low.isLowerUnbounded() ? "<min>" : low.getPrintableValue(session));
      buffer.append(", ");
      buffer.append(high.isUpperUnbounded() ? "<max>" : high.getPrintableValue(session));
      buffer.append((high.getBound() == Marker.Bound.EXACTLY) ? ']' : ')');
    }
    return buffer.toString();
  }
}

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

private FormattedMarker formatMarker(Marker marker)
{
  if (!marker.getValueBlock().isPresent()) {
    return new FormattedMarker(Optional.empty(), marker.getBound());
  }
  return new FormattedMarker(Optional.of(getVarcharValue(marker.getType(), marker.getValue())), marker.getBound());
}

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

@JsonCreator
public Range(
    @JsonProperty("low") Marker low,
    @JsonProperty("high") Marker high)
{
  requireNonNull(low, "value is null");
  requireNonNull(high, "value is null");
  if (!low.getType().equals(high.getType())) {
    throw new IllegalArgumentException(String.format("Marker types do not match: %s vs %s", low.getType(), high.getType()));
  }
  if (low.getBound() == Marker.Bound.BELOW) {
    throw new IllegalArgumentException("low bound must be EXACTLY or ABOVE");
  }
  if (high.getBound() == Marker.Bound.ABOVE) {
    throw new IllegalArgumentException("high bound must be EXACTLY or BELOW");
  }
  if (low.compareTo(high) > 0) {
    throw new IllegalArgumentException("low must be less than or equal to high");
  }
  this.low = low;
  this.high = high;
}

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

private static boolean isBetween(Range range)
{
  return !range.getLow().isLowerUnbounded() && range.getLow().getBound() == Marker.Bound.EXACTLY
      && !range.getHigh().isUpperUnbounded() && range.getHigh().getBound() == Marker.Bound.EXACTLY;
}

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

public static PrestoThriftMarker fromMarker(Marker marker)
  {
    PrestoThriftBlock value = marker.getValueBlock().isPresent() ? fromBlock(marker.getValueBlock().get(), marker.getType()) : null;
    return new PrestoThriftMarker(value, fromBound(marker.getBound()));
  }
}

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

builder.append((range.getLow().getBound() == Marker.Bound.EXACTLY) ? '[' : '(');
builder.append((range.getHigh().getBound() == Marker.Bound.EXACTLY) ? ']' : ')');

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

private static OptionalInt extractUpperBound(TupleDomain<Symbol> tupleDomain, Symbol symbol)
{
  if (tupleDomain.isNone()) {
    return OptionalInt.empty();
  }
  Domain rowNumberDomain = tupleDomain.getDomains().get().get(symbol);
  if (rowNumberDomain == null) {
    return OptionalInt.empty();
  }
  ValueSet values = rowNumberDomain.getValues();
  if (values.isAll() || values.isNone() || values.getRanges().getRangeCount() <= 0) {
    return OptionalInt.empty();
  }
  Range span = values.getRanges().getSpan();
  if (span.getHigh().isUpperUnbounded()) {
    return OptionalInt.empty();
  }
  verify(rowNumberDomain.getType().equals(BIGINT));
  long upperBound = (Long) span.getHigh().getValue();
  if (span.getHigh().getBound() == BELOW) {
    upperBound--;
  }
  if (upperBound > 0 && upperBound <= Integer.MAX_VALUE) {
    return OptionalInt.of(toIntExact(upperBound));
  }
  return OptionalInt.empty();
}

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

switch (range.getLow().getBound()) {
  case ABOVE:
    rangeConjuncts.add(toPredicate(">", range.getLow().getValue(), type, position));
    throw new IllegalArgumentException("Low marker should never use BELOW bound");
  default:
    throw new AssertionError("Unhandled bound: " + range.getLow().getBound());
switch (range.getHigh().getBound()) {
  case ABOVE:
    throw new IllegalArgumentException("High marker should never use ABOVE bound");
    break;
  default:
    throw new AssertionError("Unhandled bound: " + range.getHigh().getBound());

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

List<String> rangeConjuncts = new ArrayList<>();
if (!range.getLow().isLowerUnbounded()) {
  switch (range.getLow().getBound()) {
    case ABOVE:
      rangeConjuncts.add(toPredicate(columnName, ">", range.getLow().getValue(), type, accumulator));
      throw new IllegalArgumentException("Low marker should never use BELOW bound");
    default:
      throw new AssertionError("Unhandled bound: " + range.getLow().getBound());
  switch (range.getHigh().getBound()) {
    case ABOVE:
      throw new IllegalArgumentException("High marker should never use ABOVE bound");
      break;
    default:
      throw new AssertionError("Unhandled bound: " + range.getHigh().getBound());

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

switch (range.getLow().getBound()) {
  case ABOVE:
    rangeConjuncts.add(new ComparisonExpression(GREATER_THAN, reference, literalEncoder.toExpression(range.getLow().getValue(), type)));
    throw new IllegalStateException("Low Marker should never use BELOW bound: " + range);
  default:
    throw new AssertionError("Unhandled bound: " + range.getLow().getBound());
switch (range.getHigh().getBound()) {
  case ABOVE:
    throw new IllegalStateException("High Marker should never use ABOVE bound: " + range);
    break;
  default:
    throw new AssertionError("Unhandled bound: " + range.getHigh().getBound());

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

Document rangeConjuncts = new Document();
if (!range.getLow().isLowerUnbounded()) {
  switch (range.getLow().getBound()) {
    case ABOVE:
      rangeConjuncts.put(GT_OP, translateValue(range.getLow().getValue(), type));
      throw new IllegalArgumentException("Low Marker should never use BELOW bound: " + range);
    default:
      throw new AssertionError("Unhandled bound: " + range.getLow().getBound());
  switch (range.getHigh().getBound()) {
    case ABOVE:
      throw new IllegalArgumentException("High Marker should never use ABOVE bound: " + range);
      break;
    default:
      throw new AssertionError("Unhandled bound: " + range.getHigh().getBound());

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

switch (range.getLow().getBound()) {
  case ABOVE:
    rangeConjuncts.add(CassandraCqlUtils.validColumnName(columnHandle.getName()) + " > "
    throw new VerifyException("Low Marker should never use BELOW bound");
  default:
    throw new AssertionError("Unhandled bound: " + range.getLow().getBound());
switch (range.getHigh().getBound()) {
  case ABOVE:
    throw new VerifyException("High Marker should never use ABOVE bound");
    break;
  default:
    throw new AssertionError("Unhandled bound: " + range.getHigh().getBound());

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

if (prestoRange.getLow().isLowerUnbounded()) {
  boolean inclusive = prestoRange.getHigh().getBound() == Bound.EXACTLY;
  Text split = new Text(serializer.encode(prestoRange.getType(), prestoRange.getHigh().getValue()));
  accumuloRange = new Range(null, false, split, inclusive);
  boolean inclusive = prestoRange.getLow().getBound() == Bound.EXACTLY;
  Text split = new Text(serializer.encode(prestoRange.getType(), prestoRange.getLow().getValue()));
  accumuloRange = new Range(split, inclusive, null, false);
  boolean startKeyInclusive = prestoRange.getLow().getBound() == Bound.EXACTLY;
  Text startSplit = new Text(serializer.encode(prestoRange.getType(), prestoRange.getLow().getValue()));
  boolean endKeyInclusive = prestoRange.getHigh().getBound() == Bound.EXACTLY;
  Text endSplit = new Text(serializer.encode(prestoRange.getType(), prestoRange.getHigh().getValue()));
  accumuloRange = new Range(startSplit, startKeyInclusive, endSplit, endKeyInclusive);

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

switch (range.getLow().getBound()) {
  case ABOVE:
    rangeQueryBuilder.must(new RangeQueryBuilder(columnName).gt(getValue(type, range.getLow().getValue())));
    throw new IllegalArgumentException("Low marker should never use BELOW bound");
  default:
    throw new AssertionError("Unhandled bound: " + range.getLow().getBound());
switch (range.getHigh().getBound()) {
  case EXACTLY:
    rangeQueryBuilder.must(new RangeQueryBuilder(columnName).lte(getValue(type, range.getHigh().getValue())));
    throw new IllegalArgumentException("High marker should never use ABOVE bound");
  default:
    throw new AssertionError("Unhandled bound: " + range.getHigh().getBound());

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

Marker low = span.getLow();
if (!low.isLowerUnbounded()) {
  KuduPredicate.ComparisonOp op = (low.getBound() == Marker.Bound.ABOVE)
      ? KuduPredicate.ComparisonOp.GREATER : KuduPredicate.ComparisonOp.GREATER_EQUAL;
  KuduPredicate predicate = createComparisonPredicate(columnSchema, op, low.getValue());
  KuduPredicate.ComparisonOp op = (low.getBound() == Marker.Bound.BELOW)
      ? KuduPredicate.ComparisonOp.LESS : KuduPredicate.ComparisonOp.LESS_EQUAL;
  KuduPredicate predicate = createComparisonPredicate(columnSchema, op, high.getValue());

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

public boolean isSingleValue()
{
  return low.getBound() == Marker.Bound.EXACTLY && low.equals(high);
}

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

public String toString(ConnectorSession session)
  {
    StringBuilder buffer = new StringBuilder();
    if (isSingleValue()) {
      buffer.append('[').append(low.getPrintableValue(session)).append(']');
    }
    else {
      buffer.append((low.getBound() == Marker.Bound.EXACTLY) ? '[' : '(');
      buffer.append(low.isLowerUnbounded() ? "<min>" : low.getPrintableValue(session));
      buffer.append(", ");
      buffer.append(high.isUpperUnbounded() ? "<max>" : high.getPrintableValue(session));
      buffer.append((high.getBound() == Marker.Bound.EXACTLY) ? ']' : ')');
    }
    return buffer.toString();
  }
}

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

@JsonCreator
public Range(
    @JsonProperty("low") Marker low,
    @JsonProperty("high") Marker high)
{
  requireNonNull(low, "value is null");
  requireNonNull(high, "value is null");
  if (!low.getType().equals(high.getType())) {
    throw new IllegalArgumentException(String.format("Marker types do not match: %s vs %s", low.getType(), high.getType()));
  }
  if (low.getBound() == Marker.Bound.BELOW) {
    throw new IllegalArgumentException("low bound must be EXACTLY or ABOVE");
  }
  if (high.getBound() == Marker.Bound.ABOVE) {
    throw new IllegalArgumentException("high bound must be EXACTLY or BELOW");
  }
  if (low.compareTo(high) > 0) {
    throw new IllegalArgumentException("low must be less than or equal to high");
  }
  this.low = low;
  this.high = high;
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

private static boolean isBetween(Range range)
{
  return !range.getLow().isLowerUnbounded() && range.getLow().getBound() == Marker.Bound.EXACTLY
      && !range.getHigh().isUpperUnbounded() && range.getHigh().getBound() == Marker.Bound.EXACTLY;
}

相关文章