Search in sources :

Example 1 with NoOpResourceGroupManager

use of io.prestosql.execution.resourcegroups.NoOpResourceGroupManager 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)

Example 2 with NoOpResourceGroupManager

use of io.prestosql.execution.resourcegroups.NoOpResourceGroupManager in project hetu-core by openlookeng.

the class TestPrepareTask method executePrepare.

private Map<String, String> executePrepare(String statementName, Statement statement, String sqlString, Session session) {
    TransactionManager transactionManager = createTestTransactionManager();
    QueryStateMachine stateMachine = QueryStateMachine.begin(sqlString, Optional.empty(), session, URI.create("fake://uri"), new ResourceGroupId("test"), new NoOpResourceGroupManager(), false, transactionManager, new AccessControlManager(transactionManager), executor, metadata, WarningCollector.NOOP);
    Prepare prepare = new Prepare(identifier(statementName), statement);
    new PrepareTask(new SqlParser()).execute(prepare, transactionManager, metadata, new AllowAllAccessControl(), stateMachine, emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager()));
    return stateMachine.getAddedPreparedStatements();
}
Also used : AccessControlManager(io.prestosql.security.AccessControlManager) ResourceGroupId(io.prestosql.spi.resourcegroups.ResourceGroupId) TransactionManager(io.prestosql.transaction.TransactionManager) InMemoryTransactionManager.createTestTransactionManager(io.prestosql.transaction.InMemoryTransactionManager.createTestTransactionManager) AllowAllAccessControl(io.prestosql.security.AllowAllAccessControl) HeuristicIndexerManager(io.prestosql.heuristicindex.HeuristicIndexerManager) SqlParser(io.prestosql.sql.parser.SqlParser) Prepare(io.prestosql.sql.tree.Prepare) HetuMetaStoreManager(io.prestosql.metastore.HetuMetaStoreManager) NoOpResourceGroupManager(io.prestosql.execution.resourcegroups.NoOpResourceGroupManager) FileSystemClientManager(io.prestosql.filesystem.FileSystemClientManager)

Example 3 with NoOpResourceGroupManager

use of io.prestosql.execution.resourcegroups.NoOpResourceGroupManager in project hetu-core by openlookeng.

the class TestDeallocateTask method executeDeallocate.

private Set<String> executeDeallocate(String statementName, String sqlString, Session session) {
    TransactionManager transactionManager = createTestTransactionManager();
    AccessControl accessControl = new AccessControlManager(transactionManager);
    QueryStateMachine stateMachine = QueryStateMachine.begin(sqlString, Optional.empty(), session, URI.create("fake://uri"), new ResourceGroupId("test"), new NoOpResourceGroupManager(), false, transactionManager, accessControl, executor, metadata, WarningCollector.NOOP);
    Deallocate deallocate = new Deallocate(new Identifier(statementName));
    new DeallocateTask().execute(deallocate, transactionManager, metadata, new AllowAllAccessControl(), stateMachine, emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager()));
    return stateMachine.getDeallocatedPreparedStatements();
}
Also used : AccessControlManager(io.prestosql.security.AccessControlManager) ResourceGroupId(io.prestosql.spi.resourcegroups.ResourceGroupId) HeuristicIndexerManager(io.prestosql.heuristicindex.HeuristicIndexerManager) AllowAllAccessControl(io.prestosql.security.AllowAllAccessControl) AccessControl(io.prestosql.security.AccessControl) FileSystemClientManager(io.prestosql.filesystem.FileSystemClientManager) Identifier(io.prestosql.sql.tree.Identifier) Deallocate(io.prestosql.sql.tree.Deallocate) TransactionManager(io.prestosql.transaction.TransactionManager) InMemoryTransactionManager.createTestTransactionManager(io.prestosql.transaction.InMemoryTransactionManager.createTestTransactionManager) AllowAllAccessControl(io.prestosql.security.AllowAllAccessControl) HetuMetaStoreManager(io.prestosql.metastore.HetuMetaStoreManager) NoOpResourceGroupManager(io.prestosql.execution.resourcegroups.NoOpResourceGroupManager)

Example 4 with NoOpResourceGroupManager

use of io.prestosql.execution.resourcegroups.NoOpResourceGroupManager in project hetu-core by openlookeng.

the class TestQueryStateMachine method createQueryStateMachineWithTicker.

private QueryStateMachine createQueryStateMachineWithTicker(Ticker ticker) {
    Metadata metadata = createTestMetadataManager();
    TransactionManager transactionManager = createTestTransactionManager();
    AccessControl accessControl = new AccessControlManager(transactionManager);
    QueryStateMachine stateMachine = QueryStateMachine.beginWithTicker(QUERY, Optional.empty(), TEST_SESSION, LOCATION, new ResourceGroupId("test"), new NoOpResourceGroupManager(), false, transactionManager, accessControl, executor, ticker, metadata, WarningCollector.NOOP);
    stateMachine.setInputs(INPUTS);
    stateMachine.setOutput(OUTPUT);
    stateMachine.setColumns(OUTPUT_FIELD_NAMES, OUTPUT_FIELD_TYPES);
    stateMachine.setUpdateType(UPDATE_TYPE);
    stateMachine.setMemoryPool(MEMORY_POOL);
    for (Entry<String, String> entry : SET_SESSION_PROPERTIES.entrySet()) {
        stateMachine.addSetSessionProperties(entry.getKey(), entry.getValue());
    }
    RESET_SESSION_PROPERTIES.forEach(stateMachine::addResetSessionProperties);
    return stateMachine;
}
Also used : AccessControlManager(io.prestosql.security.AccessControlManager) ResourceGroupId(io.prestosql.spi.resourcegroups.ResourceGroupId) TransactionManager(io.prestosql.transaction.TransactionManager) InMemoryTransactionManager.createTestTransactionManager(io.prestosql.transaction.InMemoryTransactionManager.createTestTransactionManager) Metadata(io.prestosql.metadata.Metadata) AccessControl(io.prestosql.security.AccessControl) NoOpResourceGroupManager(io.prestosql.execution.resourcegroups.NoOpResourceGroupManager)

Example 5 with NoOpResourceGroupManager

use of io.prestosql.execution.resourcegroups.NoOpResourceGroupManager in project hetu-core by openlookeng.

the class TestResetSessionTask method test.

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

Aggregations

NoOpResourceGroupManager (io.prestosql.execution.resourcegroups.NoOpResourceGroupManager)6 ResourceGroupId (io.prestosql.spi.resourcegroups.ResourceGroupId)6 FileSystemClientManager (io.prestosql.filesystem.FileSystemClientManager)5 HeuristicIndexerManager (io.prestosql.heuristicindex.HeuristicIndexerManager)5 HetuMetaStoreManager (io.prestosql.metastore.HetuMetaStoreManager)5 AccessControlManager (io.prestosql.security.AccessControlManager)3 InMemoryTransactionManager.createTestTransactionManager (io.prestosql.transaction.InMemoryTransactionManager.createTestTransactionManager)3 TransactionManager (io.prestosql.transaction.TransactionManager)3 AccessControl (io.prestosql.security.AccessControl)2 AllowAllAccessControl (io.prestosql.security.AllowAllAccessControl)2 Session (io.prestosql.Session)1 Metadata (io.prestosql.metadata.Metadata)1 SqlParser (io.prestosql.sql.parser.SqlParser)1 Deallocate (io.prestosql.sql.tree.Deallocate)1 Identifier (io.prestosql.sql.tree.Identifier)1 Prepare (io.prestosql.sql.tree.Prepare)1 QualifiedName (io.prestosql.sql.tree.QualifiedName)1 ResetSession (io.prestosql.sql.tree.ResetSession)1 SetRole (io.prestosql.sql.tree.SetRole)1 SetSession (io.prestosql.sql.tree.SetSession)1