use of io.crate.operation.predicate.NotPredicate in project crate by crate.
the class AnyLikeOperatorTest method testNegateLike.
@Test
public void testNegateLike() throws Exception {
Literal patternLiteral = Literal.of("A");
Literal valuesLiteral = Literal.of(new ArrayType(DataTypes.STRING), new Object[] { new BytesRef("A"), new BytesRef("B") });
FunctionImplementation impl = new AnyLikeOperator.AnyLikeResolver().getForTypes(Arrays.asList(DataTypes.STRING, valuesLiteral.valueType()));
Function anyLikeFunction = new Function(impl.info(), Arrays.<Symbol>asList(patternLiteral, valuesLiteral));
Input<Boolean> normalized = (Input<Boolean>) impl.normalizeSymbol(anyLikeFunction, new TransactionContext(SessionContext.SYSTEM_SESSION));
assertThat(normalized.value(), is(true));
assertThat(new NotPredicate().evaluate(normalized), is(false));
}
use of io.crate.operation.predicate.NotPredicate in project crate by crate.
the class AnyNotLikeOperatorTest method testNegateNotLike.
@Test
public void testNegateNotLike() throws Exception {
Literal patternLiteral = Literal.of("A");
Literal valuesLiteral = Literal.of(new ArrayType(DataTypes.STRING), new Object[] { new BytesRef("A"), new BytesRef("B") });
FunctionImplementation impl = new AnyNotLikeOperator.AnyNotLikeResolver().getForTypes(Arrays.asList(DataTypes.STRING, valuesLiteral.valueType()));
Function anyNotLikeFunction = new Function(impl.info(), Arrays.<Symbol>asList(patternLiteral, valuesLiteral));
Input<Boolean> normalized = (Input<Boolean>) impl.normalizeSymbol(anyNotLikeFunction, new TransactionContext(SessionContext.SYSTEM_SESSION));
assertThat(normalized.value(), is(true));
assertThat(new NotPredicate().evaluate(normalized), is(false));
}
Aggregations