use of io.confluent.ksql.parser.tree.LikePredicate in project ksql by confluentinc.
the class ExpressionFormatterTest method shouldFormatLikePredicate.
@Test
public void shouldFormatLikePredicate() {
final LikePredicate predicate = new LikePredicate(new StringLiteral("string"), new StringLiteral("*"), new StringLiteral("\\"));
assertThat(ExpressionFormatter.formatExpression(predicate), equalTo("('string' LIKE '*' ESCAPE '\\')"));
}
use of io.confluent.ksql.parser.tree.LikePredicate in project ksql by confluentinc.
the class AstBuilder method visitLike.
@Override
public Node visitLike(SqlBaseParser.LikeContext context) {
Expression escape = null;
if (context.escape != null) {
escape = (Expression) visit(context.escape);
}
Expression result = new LikePredicate(getLocation(context), (Expression) visit(context.value), (Expression) visit(context.pattern), escape);
if (context.NOT() != null) {
result = new NotExpression(getLocation(context), result);
}
return result;
}
Aggregations