Search in sources :

Example 1 with SetRole

use of io.prestosql.sql.tree.SetRole in project hetu-core by openlookeng.

the class TestSqlParser method testSetRole.

@Test
public void testSetRole() {
    assertStatement("SET ROLE ALL", new SetRole(SetRole.Type.ALL, Optional.empty()));
    assertStatement("SET ROLE NONE", new SetRole(SetRole.Type.NONE, Optional.empty()));
    assertStatement("SET ROLE role", new SetRole(SetRole.Type.ROLE, Optional.of(new Identifier("role"))));
    assertStatement("SET ROLE \"role\"", new SetRole(SetRole.Type.ROLE, Optional.of(new Identifier("role"))));
}
Also used : SetRole(io.prestosql.sql.tree.SetRole) Identifier(io.prestosql.sql.tree.Identifier) QueryUtil.quotedIdentifier(io.prestosql.sql.QueryUtil.quotedIdentifier) Test(org.testng.annotations.Test)

Example 2 with SetRole

use of io.prestosql.sql.tree.SetRole in project hetu-core by openlookeng.

the class TestSetRoleTask method assertSetRole.

private void assertSetRole(String statement, Map<String, SelectedRole> expected) {
    SetRole setRole = (SetRole) parser.createStatement(statement);
    QueryStateMachine stateMachine = QueryStateMachine.begin(statement, Optional.empty(), testSessionBuilder().setCatalog(CATALOG_NAME).build(), URI.create("fake://uri"), new ResourceGroupId("test"), new NoOpResourceGroupManager(), false, transactionManager, accessControl, executor, metadata, WarningCollector.NOOP);
    new SetRoleTask().execute(setRole, transactionManager, metadata, accessControl, stateMachine, ImmutableList.of(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager()));
    QueryInfo queryInfo = stateMachine.getQueryInfo(Optional.empty());
    assertEquals(queryInfo.getSetRoles(), expected);
}
Also used : SetRole(io.prestosql.sql.tree.SetRole) ResourceGroupId(io.prestosql.spi.resourcegroups.ResourceGroupId) HeuristicIndexerManager(io.prestosql.heuristicindex.HeuristicIndexerManager) HetuMetaStoreManager(io.prestosql.metastore.HetuMetaStoreManager) NoOpResourceGroupManager(io.prestosql.execution.resourcegroups.NoOpResourceGroupManager) FileSystemClientManager(io.prestosql.filesystem.FileSystemClientManager)

Aggregations

SetRole (io.prestosql.sql.tree.SetRole)2 NoOpResourceGroupManager (io.prestosql.execution.resourcegroups.NoOpResourceGroupManager)1 FileSystemClientManager (io.prestosql.filesystem.FileSystemClientManager)1 HeuristicIndexerManager (io.prestosql.heuristicindex.HeuristicIndexerManager)1 HetuMetaStoreManager (io.prestosql.metastore.HetuMetaStoreManager)1 ResourceGroupId (io.prestosql.spi.resourcegroups.ResourceGroupId)1 QueryUtil.quotedIdentifier (io.prestosql.sql.QueryUtil.quotedIdentifier)1 Identifier (io.prestosql.sql.tree.Identifier)1 Test (org.testng.annotations.Test)1