use of io.confluent.ksql.execution.expression.tree.IsNotNullPredicate in project ksql by confluentinc.
the class ExpressionTreeRewriterTest method shouldRewriteIsNotNullPredicate.
@Test
public void shouldRewriteIsNotNullPredicate() {
// Given:
final IsNotNullPredicate parsed = parseExpression("col0 IS NOT NULL");
when(processor.apply(parsed.getValue(), context)).thenReturn(expr1);
// When:
final Expression rewritten = expressionRewriter.rewrite(parsed, context);
// Then:
assertThat(rewritten, equalTo(new IsNotNullPredicate(parsed.getLocation(), expr1)));
}
use of io.confluent.ksql.execution.expression.tree.IsNotNullPredicate in project ksql by confluentinc.
the class InterpretedExpressionTest method shouldEvaluateIsNotNullPredicate.
@Test
public void shouldEvaluateIsNotNullPredicate() {
// Given:
final Expression expression1 = new IsNotNullPredicate(COL11);
final Expression expression2 = new IsNotNullPredicate(new NullLiteral());
// When:
InterpretedExpression interpreter1 = interpreter(expression1);
InterpretedExpression interpreter2 = interpreter(expression2);
// Then:
assertThat(interpreter1.evaluate(make(11, true)), is(true));
assertThat(interpreter1.evaluate(make(11, null)), is(false));
assertThat(interpreter2.evaluate(ROW), is(false));
}
Aggregations