Search in sources :

Example 1 with SetPath

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());
    }
}
Also used : SetPath(io.prestosql.sql.tree.SetPath) Identifier(io.prestosql.sql.tree.Identifier) QueryUtil.quotedIdentifier(io.prestosql.sql.QueryUtil.quotedIdentifier) PathElement(io.prestosql.sql.tree.PathElement) PathSpecification(io.prestosql.sql.tree.PathSpecification) Test(org.testng.annotations.Test)

Aggregations

QueryUtil.quotedIdentifier (io.prestosql.sql.QueryUtil.quotedIdentifier)1 Identifier (io.prestosql.sql.tree.Identifier)1 PathElement (io.prestosql.sql.tree.PathElement)1 PathSpecification (io.prestosql.sql.tree.PathSpecification)1 SetPath (io.prestosql.sql.tree.SetPath)1 Test (org.testng.annotations.Test)1