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