use of io.prestosql.sql.tree.SetPath in project hetu-core by openlookeng.
the class TestSqlParser method testSetPath.
@Test
public void testSetPath() {
assertStatement("SET PATH iLikeToEat.apples, andBananas", new SetPath(new PathSpecification(Optional.empty(), ImmutableList.of(new PathElement(Optional.of(new Identifier("iLikeToEat")), new Identifier("apples")), new PathElement(Optional.empty(), new Identifier("andBananas"))))));
assertStatement("SET PATH \"schemas,with\".\"grammar.in\", \"their!names\"", new SetPath(new PathSpecification(Optional.empty(), ImmutableList.of(new PathElement(Optional.of(new Identifier("schemas,with")), new Identifier("grammar.in")), new PathElement(Optional.empty(), new Identifier("their!names"))))));
try {
assertStatement("SET PATH one.too.many, qualifiers", new SetPath(new PathSpecification(Optional.empty(), ImmutableList.of(new PathElement(Optional.empty(), new Identifier("dummyValue"))))));
fail();
} catch (RuntimeException e) {
// expected - schema can only be qualified by catalog
log.error("testSetPath error : ", e.getMessage());
}
try {
SQL_PARSER.createStatement("SET PATH ", new ParsingOptions());
fail();
} catch (RuntimeException e) {
// expected - some form of parameter is required
log.error("testSetPath error : ", e.getMessage());
}
}
Aggregations