热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

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

本文整理了Java中com.facebook.presto.spi.predicate.ValueSet.complement()方法的一些代码示例,展示了

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

ValueSet.complement介绍

暂无

代码示例

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

private static ValueSet complementIfNecessary(ValueSet valueSet, boolean complement)
{
return complement ? valueSet.complement() : valueSet;
}

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

default ValueSet subtract(ValueSet other)
{
return this.intersect(other.complement());
}

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

public Domain complement()
{
return new Domain(values.complement(), !nullAllowed);
}

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

private static Domain extractEquatableDomain(ComparisonExpression.Operator comparisonOperator, Type type, Object value, boolean complement)
{
checkArgument(value != null);
switch (comparisonOperator) {
case EQUAL:
return Domain.create(complementIfNecessary(ValueSet.of(type, value), complement), false);
case NOT_EQUAL:
return Domain.create(complementIfNecessary(ValueSet.of(type, value).complement(), complement), false);
case IS_DISTINCT_FROM:
// Need to potential complement the whole domain for IS_DISTINCT_FROM since it is null-aware
return complementIfNecessary(Domain.create(ValueSet.of(type, value).complement(), true), complement);
default:
throw new AssertionError("Unhandled operator: " + comparisonOperator);
}
}

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

@Test
public void testEquatableSingleValue()
{
Domain domain = Domain.singleValue(ID, 0L);
assertFalse(domain.isNone());
assertFalse(domain.isAll());
assertTrue(domain.isSingleValue());
assertTrue(domain.isNullableSingleValue());
assertFalse(domain.isOnlyNull());
assertFalse(domain.isNullAllowed());
assertEquals(domain.getValues(), ValueSet.of(ID, 0L));
assertEquals(domain.getType(), ID);
assertTrue(domain.includesNullableValue(0L));
assertFalse(domain.includesNullableValue(null));
assertEquals(domain.complement(), Domain.create(ValueSet.of(ID, 0L).complement(), true));
assertEquals(domain.getSingleValue(), 0L);
assertEquals(domain.getNullableSingleValue(), 0L);
try {
Domain.create(ValueSet.of(ID, 0L, 1L), false).getSingleValue();
fail();
}
catch (IllegalStateException e) {
}
}

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

@Test
public void testFromInPredicate()
{
assertPredicateTranslates(
in(C_BIGINT, ImmutableList.of(1L)),
withColumnDomains(ImmutableMap.of(C_BIGINT, Domain.singleValue(BIGINT, 1L))));
assertPredicateTranslates(
in(C_COLOR, ImmutableList.of(colorLiteral(COLOR_VALUE_1))),
withColumnDomains(ImmutableMap.of(C_COLOR, Domain.singleValue(COLOR, COLOR_VALUE_1))));
assertPredicateTranslates(
in(C_BIGINT, ImmutableList.of(1L, 2L)),
withColumnDomains(ImmutableMap.of(C_BIGINT, Domain.create(ValueSet.ofRanges(Range.equal(BIGINT, 1L), Range.equal(BIGINT, 2L)), false))));
assertPredicateTranslates(
in(C_COLOR, ImmutableList.of(colorLiteral(COLOR_VALUE_1), colorLiteral(COLOR_VALUE_2))),
withColumnDomains(ImmutableMap.of(C_COLOR, Domain.create(ValueSet.of(COLOR, COLOR_VALUE_1, COLOR_VALUE_2), false))));
assertPredicateTranslates(
not(in(C_BIGINT, ImmutableList.of(1L, 2L))),
withColumnDomains(ImmutableMap.of(C_BIGINT, Domain.create(ValueSet.ofRanges(Range.lessThan(BIGINT, 1L), Range.range(BIGINT, 1L, false, 2L, false), Range.greaterThan(BIGINT, 2L)), false))));
assertPredicateTranslates(
not(in(C_COLOR, ImmutableList.of(colorLiteral(COLOR_VALUE_1), colorLiteral(COLOR_VALUE_2)))),
withColumnDomains(ImmutableMap.of(C_COLOR, Domain.create(ValueSet.of(COLOR, COLOR_VALUE_1, COLOR_VALUE_2).complement(), false))));
}

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

assertEquals(toPredicate(tupleDomain), or(equal(C_COLOR, colorLiteral(COLOR_VALUE_1)), isNull(C_COLOR)));
tupleDomain = withColumnDomains(ImmutableMap.of(C_COLOR, Domain.create(ValueSet.of(COLOR, COLOR_VALUE_1).complement(), true)));
assertEquals(toPredicate(tupleDomain), or(not(equal(C_COLOR, colorLiteral(COLOR_VALUE_1))), isNull(C_COLOR)));

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

withColumnDomains(ImmutableMap.of(C_COLOR, Domain.create(ValueSet.of(COLOR, COLOR_VALUE_1).complement(), false))));
withColumnDomains(ImmutableMap.of(C_COLOR, Domain.create(ValueSet.of(COLOR, COLOR_VALUE_1).complement(), true))));

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

withColumnDomains(ImmutableMap.of(C_COLOR, Domain.create(ValueSet.of(COLOR, COLOR_VALUE_1).complement(), true))));
withColumnDomains(ImmutableMap.of(C_COLOR, Domain.create(ValueSet.of(COLOR, COLOR_VALUE_1).complement(), false))));
withColumnDomains(ImmutableMap.of(C_COLOR, Domain.create(ValueSet.of(COLOR, COLOR_VALUE_1, COLOR_VALUE_2).complement(), false))));

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

private static ValueSet complementIfNecessary(ValueSet valueSet, boolean complement)
{
return complement ? valueSet.complement() : valueSet;
}

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

public Domain complement()
{
return new Domain(values.complement(), !nullAllowed);
}

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

default ValueSet subtract(ValueSet other)
{
return this.intersect(other.complement());
}

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

private static Domain extractEquatableDomain(ComparisonExpression.Type comparisonType, Type type, Object value, boolean complement)
{
checkArgument(value != null);
switch (comparisonType) {
case EQUAL:
return Domain.create(complementIfNecessary(ValueSet.of(type, value), complement), false);
case NOT_EQUAL:
return Domain.create(complementIfNecessary(ValueSet.of(type, value).complement(), complement), false);
case IS_DISTINCT_FROM:
// Need to potential complement the whole domain for IS_DISTINCT_FROM since it is null-aware
return complementIfNecessary(Domain.create(ValueSet.of(type, value).complement(), true), complement);
default:
throw new AssertionError("Unhandled type: " + comparisonType);
}
}

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

result = fromPredicate(originalExpression);
assertEquals(result.getRemainingExpression(), TRUE_LITERAL);
assertEquals(result.getTupleDomain(), withColumnDomains(ImmutableMap.of(J, Domain.create(ValueSet.of(COLOR, COLOR_VALUE_1, COLOR_VALUE_2).complement(), false))));

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

assertEquals(toPredicate(tupleDomain), or(equal(J, colorLiteral(COLOR_VALUE_1)), isNull(J)));
tupleDomain = withColumnDomains(ImmutableMap.of(J, Domain.create(ValueSet.of(COLOR, COLOR_VALUE_1).complement(), true)));
assertEquals(toPredicate(tupleDomain), or(not(equal(J, colorLiteral(COLOR_VALUE_1))), isNull(J)));

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

result = fromPredicate(originalExpression);
assertEquals(result.getRemainingExpression(), TRUE_LITERAL);
assertEquals(result.getTupleDomain(), withColumnDomains(ImmutableMap.of(J, Domain.create(ValueSet.of(COLOR, COLOR_VALUE_1).complement(), false))));
result = fromPredicate(originalExpression);
assertEquals(result.getRemainingExpression(), TRUE_LITERAL);
assertEquals(result.getTupleDomain(), withColumnDomains(ImmutableMap.of(J, Domain.create(ValueSet.of(COLOR, COLOR_VALUE_1).complement(), true))));

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

result = fromPredicate(originalExpression);
assertEquals(result.getRemainingExpression(), TRUE_LITERAL);
assertEquals(result.getTupleDomain(), withColumnDomains(ImmutableMap.of(J, Domain.create(ValueSet.of(COLOR, COLOR_VALUE_1).complement(), true))));
result = fromPredicate(originalExpression);
assertEquals(result.getRemainingExpression(), TRUE_LITERAL);
assertEquals(result.getTupleDomain(), withColumnDomains(ImmutableMap.of(J, Domain.create(ValueSet.of(COLOR, COLOR_VALUE_1).complement(), false))));
assertEquals(result.getTupleDomain(), withColumnDomains(ImmutableMap.of(J, Domain.create(ValueSet.of(COLOR, COLOR_VALUE_1, COLOR_VALUE_2).complement(), false))));

推荐阅读
author-avatar
溪边莎草
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有