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

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

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

Range.getSingleValue介绍

暂无

代码示例

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

@Override
public Object getSingleValue()
{
  if (!isSingleValue()) {
    throw new IllegalStateException("SortedRangeSet does not have just a single value");
  }
  return lowIndexedRanges.values().iterator().next().getSingleValue();
}

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

@VisibleForTesting
public static Optional<Collection<Object>> extractDiscreteValues(ValueSet valueSet)
{
  return valueSet.getValuesProcessor().transform(
      ranges -> {
        ImmutableList.Builder<Object> discreteValues = ImmutableList.builder();
        for (Range range : ranges.getOrderedRanges()) {
          if (!range.isSingleValue()) {
            return Optional.empty();
          }
          discreteValues.add(range.getSingleValue());
        }
        return Optional.of(discreteValues.build());
      },
      discreteValues -> Optional.of(discreteValues.getValues()),
      allOrNone -> allOrNone.isAll() ? Optional.empty() : Optional.of(ImmutableList.of()));
}

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

@Test
public void testGetSingleValue()
{
  assertEquals(Range.equal(BIGINT, 0L).getSingleValue(), 0L);
  try {
    Range.lessThan(BIGINT, 0L).getSingleValue();
    fail();
  }
  catch (IllegalStateException e) {
  }
}

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

return ImmutableSet.of();
Object value = range.getSingleValue();

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

singleValues.add(literalEncoder.toExpression(range.getSingleValue(), type));
continue;
singleValuesInRange.add(literalEncoder.toExpression(singleValueExclusions.next().getSingleValue(), type));

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

StringBuilder builder = new StringBuilder();
if (range.isSingleValue()) {
  String value = castToVarchar(type, range.getSingleValue(), functionRegistry, session);
  builder.append('[').append(value).append(']');

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

singleValues.add(CassandraCqlUtils.cqlValue(toCQLCompatibleString(range.getSingleValue()),
    columnHandle.getCassandraType()));

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

for (Range range : domain.getValues().getRanges().getOrderedRanges()) {
  if (range.isSingleValue()) {
    singleValues.add(translateValue(range.getSingleValue(), type));

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

Text split = new Text(serializer.encode(prestoRange.getType(), prestoRange.getSingleValue()));
accumuloRange = new Range(split);

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

@Override
public Object getSingleValue()
{
  if (!isSingleValue()) {
    throw new IllegalStateException("SortedRangeSet does not have just a single value");
  }
  return lowIndexedRanges.values().iterator().next().getSingleValue();
}

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

private static String createShardPredicate(ImmutableList.Builder<JDBCType> types, ImmutableList.Builder<Object> values, Domain domain, JDBCType jdbcType)
{
  List<Range> ranges = domain.getValues().getRanges().getOrderedRanges();
  // only apply predicates if all ranges are single values
  if (ranges.isEmpty() || !ranges.stream().allMatch(Range::isSingleValue)) {
    return "true";
  }
  ImmutableList.Builder<Object> valuesBuilder = ImmutableList.builder();
  ImmutableList.Builder<JDBCType> typesBuilder = ImmutableList.builder();
  StringJoiner rangePredicate = new StringJoiner(" OR ");
  for (Range range : ranges) {
    Slice uuidText = (Slice) range.getSingleValue();
    try {
      Slice uuidBytes = uuidStringToBytes(uuidText);
      typesBuilder.add(jdbcType);
      valuesBuilder.add(uuidBytes);
    }
    catch (IllegalArgumentException e) {
      return "true";
    }
    rangePredicate.add("shard_uuid = ?");
  }
  types.addAll(typesBuilder.build());
  values.addAll(valuesBuilder.build());
  return rangePredicate.toString();
}

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

@VisibleForTesting
public static Optional<Collection<Object>> extractDiscreteValues(ValueSet valueSet)
{
  return valueSet.getValuesProcessor().transform(
      ranges -> {
        ImmutableList.Builder<Object> discreteValues = ImmutableList.builder();
        for (Range range : ranges.getOrderedRanges()) {
          if (!range.isSingleValue()) {
            return Optional.empty();
          }
          discreteValues.add(range.getSingleValue());
        }
        return Optional.of(discreteValues.build());
      },
      discreteValues -> Optional.of(discreteValues.getValues()),
      allOrNone -> allOrNone.isAll() ? Optional.empty() : Optional.of(ImmutableList.of()));
}

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

return ImmutableSet.of();
Object value = range.getSingleValue();

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

StringBuilder builder = new StringBuilder();
if (range.isSingleValue()) {
  String value = castToVarchar(type, range.getSingleValue(), PlanPrinter.this.metadata, session);
  builder.append('[').append(value).append(']');

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

singleValues.add(toExpression(range.getSingleValue(), type));
continue;
singleValuesInRange.add(toExpression(singleValueExclusions.next().getSingleValue(), type));

代码示例来源:origin: harbby/presto-connectors

checkArgument(range.isSingleValue(), "dsl is must [=] demo where _dsl = \"..dsl string\"");
checkArgument(range.getType() instanceof VarcharType, "_dsl filter is not string");
String dsl = ((Slice) range.getSingleValue()).toStringUtf8();
dslCacher.put(columnName, dsl);
if (!"_dsl".equals(columnName)) {

代码示例来源:origin: harbby/presto-connectors

Object value = prestoRange.getSingleValue();
hbaseScan.setStartRow(toHbaseBytes(type, value));
hbaseScan.setStopRow(toHbaseBytes(type, value));

代码示例来源:origin: harbby/presto-connectors

Object value = prestoRange.getSingleValue();
qb.must(QueryBuilders.termQuery(columnName, EsTypeManager.getTypeValue(type, value)));

代码示例来源:origin: harbby/presto-connectors

Object value = prestoRange.getSingleValue();
qb.must(QueryBuilders.termQuery(columnName, EsTypeManager.getTypeValue(type, value)));

代码示例来源:origin: harbby/presto-connectors

Object value = prestoRange.getSingleValue();
qb.must(QueryBuilders.termQuery(columnName, EsTypeManager.getTypeValue(type, value)));

相关文章