本文整理了Java中io.prestosql.spi.predicate.Range.getSingleValue
方法的一些代码示例,展示了Range.getSingleValue
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.getSingleValue
方法的具体详情如下:
包路径:io.prestosql.spi.predicate.Range
类名称:Range
方法名:getSingleValue
暂无
代码示例来源:origin: prestosql/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: prestosql/presto
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: io.prestosql/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: prestosql/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: io.prestosql/presto-spi
@Test
public void testGetSingleValue()
{
assertEquals(Range.equal(BIGINT, 0L).getSingleValue(), 0L);
try {
Range.lessThan(BIGINT, 0L).getSingleValue();
fail();
}
catch (IllegalStateException e) {
}
}
代码示例来源:origin: prestosql/presto
@Test
public void testGetSingleValue()
{
assertEquals(Range.equal(BIGINT, 0L).getSingleValue(), 0L);
try {
Range.lessThan(BIGINT, 0L).getSingleValue();
fail();
}
catch (IllegalStateException e) {
}
}
代码示例来源:origin: prestosql/presto
return ImmutableSet.of();
Object value = range.getSingleValue();
代码示例来源:origin: io.prestosql/presto-main
singleValues.add(literalEncoder.toExpression(range.getSingleValue(), type));
continue;
singleValuesInRange.add(literalEncoder.toExpression(singleValueExclusions.next().getSingleValue(), type));
代码示例来源:origin: prestosql/presto
singleValues.add(literalEncoder.toExpression(range.getSingleValue(), type));
continue;
singleValuesInRange.add(literalEncoder.toExpression(singleValueExclusions.next().getSingleValue(), type));
代码示例来源:origin: prestosql/presto
StringBuilder builder = new StringBuilder();
if (range.isSingleValue()) {
String value = castToVarchar(type, range.getSingleValue(), functionRegistry, session);
builder.append('[').append(value).append(']');
代码示例来源:origin: io.prestosql/presto-main
StringBuilder builder = new StringBuilder();
if (range.isSingleValue()) {
String value = castToVarchar(type, range.getSingleValue(), functionRegistry, session);
builder.append('[').append(value).append(']');
代码示例来源:origin: prestosql/presto
Object maxValue = null;
if (range.isSingleValue()) {
minValue = range.getSingleValue();
maxValue = range.getSingleValue();
代码示例来源:origin: prestosql/presto
singleValues.add(CassandraCqlUtils.cqlValue(toCQLCompatibleString(range.getSingleValue()),
columnHandle.getCassandraType()));
代码示例来源:origin: prestosql/presto
for (Range range : domain.getValues().getRanges().getOrderedRanges()) {
if (range.isSingleValue()) {
singleValues.add(translateValue(range.getSingleValue(), type));
内容来源于网络,如有侵权,请联系作者删除!