Search in sources :

Example 1 with MatchPredicate

use of io.crate.sql.tree.MatchPredicate in project crate by crate.

the class TestStatementBuilder method testSafeSubscriptExpression.

@Test
public void testSafeSubscriptExpression() {
    MatchPredicate matchPredicate = (MatchPredicate) SqlParser.createExpression("match (a['1']['2'], 'abc')");
    assertThat(matchPredicate.idents().get(0).columnIdent().toString(), is("\"a\"['1']['2']"));
    matchPredicate = (MatchPredicate) SqlParser.createExpression("match (a['1']['2']['4'], 'abc')");
    assertThat(matchPredicate.idents().get(0).columnIdent().toString(), is("\"a\"['1']['2']['4']"));
    assertThrows(ParsingException.class, () -> SqlParser.createExpression("match ([1]['1']['2'], 'abc')"), "mismatched input '<EOF>' expecting 'SET'");
}
Also used : MatchPredicate(io.crate.sql.tree.MatchPredicate) Test(org.junit.Test)

Aggregations

MatchPredicate (io.crate.sql.tree.MatchPredicate)1 Test (org.junit.Test)1