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"));
}
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")));
}
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>");
}
Aggregations