Search in sources :

Example 1 with ResetSession

use of io.trino.sql.tree.ResetSession in project trino by trinodb.

the class TestResetSessionTask method test.

@Test
public void test() {
    Session session = testSessionBuilder(sessionPropertyManager).setSystemProperty("foo", "bar").setCatalogSessionProperty(CATALOG_NAME, "baz", "blah").build();
    QueryStateMachine stateMachine = QueryStateMachine.begin(Optional.empty(), "reset foo", Optional.empty(), session, URI.create("fake://uri"), new ResourceGroupId("test"), false, transactionManager, accessControl, executor, metadata, WarningCollector.NOOP, Optional.empty());
    getFutureValue(new ResetSessionTask(metadata, sessionPropertyManager).execute(new ResetSession(QualifiedName.of(CATALOG_NAME, "baz")), stateMachine, emptyList(), WarningCollector.NOOP));
    Set<String> sessionProperties = stateMachine.getResetSessionProperties();
    assertEquals(sessionProperties, ImmutableSet.of(CATALOG_NAME + ".baz"));
}
Also used : ResourceGroupId(io.trino.spi.resourcegroups.ResourceGroupId) ResetSession(io.trino.sql.tree.ResetSession) ResetSession(io.trino.sql.tree.ResetSession) Session(io.trino.Session) Test(org.testng.annotations.Test)

Example 2 with ResetSession

use of io.trino.sql.tree.ResetSession in project trino by trinodb.

the class TestSqlParser method testResetSession.

@Test
public void testResetSession() {
    assertStatement("RESET SESSION foo.bar", new ResetSession(QualifiedName.of("foo", "bar")));
    assertStatement("RESET SESSION foo", new ResetSession(QualifiedName.of("foo")));
}
Also used : ResetSession(io.trino.sql.tree.ResetSession) Test(org.junit.jupiter.api.Test)

Example 3 with ResetSession

use of io.trino.sql.tree.ResetSession in project trino by trinodb.

the class TestSqlParser method testSessionIdentifiers.

@Test
public void testSessionIdentifiers() {
    assertStatement("SET SESSION \"foo-bar\".baz = 'x'", new SetSession(QualifiedName.of("foo-bar", "baz"), new StringLiteral("x")));
    assertStatementIsInvalid("SET SESSION foo-bar.name = 'value'").withMessage("line 1:16: mismatched input '-'. Expecting: '.', '='");
    assertStatement("RESET SESSION \"foo-bar\".baz", new ResetSession(QualifiedName.of("foo-bar", "baz")));
    assertStatementIsInvalid("RESET SESSION foo-bar.name").withMessage("line 1:18: mismatched input '-'. Expecting: '.', <EOF>");
}
Also used : SetSession(io.trino.sql.tree.SetSession) StringLiteral(io.trino.sql.tree.StringLiteral) ResetSession(io.trino.sql.tree.ResetSession) Test(org.junit.jupiter.api.Test)

Aggregations

ResetSession (io.trino.sql.tree.ResetSession)3 Test (org.junit.jupiter.api.Test)2 Session (io.trino.Session)1 ResourceGroupId (io.trino.spi.resourcegroups.ResourceGroupId)1 SetSession (io.trino.sql.tree.SetSession)1 StringLiteral (io.trino.sql.tree.StringLiteral)1 Test (org.testng.annotations.Test)1