use of io.crate.sql.tree.ArrayLikePredicate in project crate by crate.
the class TestStatementBuilder method testArrayLikeExpression.
@Test
public void testArrayLikeExpression() {
Expression expression = SqlParser.createExpression("'books%' LIKE ANY(race['interests'])");
assertThat(expression, instanceOf(ArrayLikePredicate.class));
ArrayLikePredicate arrayLikePredicate = (ArrayLikePredicate) expression;
assertThat(arrayLikePredicate.inverse(), is(false));
assertThat(arrayLikePredicate.getEscape(), is(nullValue()));
assertThat(arrayLikePredicate.getPattern().toString(), is("'books%'"));
assertThat(arrayLikePredicate.getValue().toString(), is("\"race\"['interests']"));
expression = SqlParser.createExpression("'b%' NOT LIKE ANY(race)");
assertThat(expression, instanceOf(ArrayLikePredicate.class));
arrayLikePredicate = (ArrayLikePredicate) expression;
assertThat(arrayLikePredicate.inverse(), is(true));
assertThat(arrayLikePredicate.getEscape(), is(nullValue()));
assertThat(arrayLikePredicate.getPattern().toString(), is("'b%'"));
assertThat(arrayLikePredicate.getValue().toString(), is("\"race\""));
}
Aggregations