Search in sources :

Example 21 with HeuristicIndexerManager

use of io.prestosql.heuristicindex.HeuristicIndexerManager in project hetu-core by openlookeng.

the class TestDropCacheTask method testDropCacheNotExistsTrue.

@Test
public void testDropCacheNotExistsTrue() {
    QualifiedName tableName = QualifiedName.of(CATALOG_NAME, schema, table);
    DropCache statement = new DropCache(tableName, true);
    getFutureValue(new DropCacheTask().execute(statement, createTestTransactionManager(), metadata, new AllowAllAccessControl(), stateMachine, Collections.emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())));
    assertFalse(SplitCacheMap.getInstance().cacheExists(tableName));
    QualifiedName table2Name = QualifiedName.of(CATALOG_NAME, schema, table2);
    DropCache statement2 = new DropCache(table2Name, true);
    assertTrue(SplitCacheMap.getInstance().cacheExists(table2Name));
    getFutureValue(new DropCacheTask().execute(statement2, createTestTransactionManager(), metadata, new AllowAllAccessControl(), stateMachine, Collections.emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())));
    assertFalse(SplitCacheMap.getInstance().cacheExists(table2Name));
}
Also used : DropCache(io.prestosql.sql.tree.DropCache) AllowAllAccessControl(io.prestosql.security.AllowAllAccessControl) QualifiedName(io.prestosql.sql.tree.QualifiedName) HeuristicIndexerManager(io.prestosql.heuristicindex.HeuristicIndexerManager) HetuMetaStoreManager(io.prestosql.metastore.HetuMetaStoreManager) FileSystemClientManager(io.prestosql.filesystem.FileSystemClientManager) Test(org.testng.annotations.Test)

Example 22 with HeuristicIndexerManager

use of io.prestosql.heuristicindex.HeuristicIndexerManager in project hetu-core by openlookeng.

the class TestDropCacheTask method testDropCacheNotExistsFalse.

@Test
public void testDropCacheNotExistsFalse() {
    DropCache statement = new DropCache(QualifiedName.of("test_nonexistent_table"), false);
    QueryStateMachine queryStateMachine = createQueryStateMachine("START TRANSACTION", testSession, transactionManager);
    try {
        getFutureValue(new DropCacheTask().execute(statement, createTestTransactionManager(), metadata, new AllowAllAccessControl(), queryStateMachine, Collections.emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())));
        fail("expected exception");
    } catch (RuntimeException e) {
        // Expected
        assertTrue(e instanceof SemanticException);
        SemanticException semanticException = (SemanticException) e;
        assertEquals(semanticException.getCode(), SemanticErrorCode.MISSING_CACHE);
    }
}
Also used : DropCache(io.prestosql.sql.tree.DropCache) AllowAllAccessControl(io.prestosql.security.AllowAllAccessControl) HeuristicIndexerManager(io.prestosql.heuristicindex.HeuristicIndexerManager) HetuMetaStoreManager(io.prestosql.metastore.HetuMetaStoreManager) FileSystemClientManager(io.prestosql.filesystem.FileSystemClientManager) SemanticException(io.prestosql.sql.analyzer.SemanticException) Test(org.testng.annotations.Test)

Example 23 with HeuristicIndexerManager

use of io.prestosql.heuristicindex.HeuristicIndexerManager 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)

Example 24 with HeuristicIndexerManager

use of io.prestosql.heuristicindex.HeuristicIndexerManager in project hetu-core by openlookeng.

the class TestRollbackTask method testRollback.

@Test
public void testRollback() {
    TransactionManager transactionManager = createTestTransactionManager();
    Session session = sessionBuilder().setTransactionId(transactionManager.beginTransaction(false)).build();
    QueryStateMachine stateMachine = createQueryStateMachine("ROLLBACK", session, transactionManager);
    assertTrue(stateMachine.getSession().getTransactionId().isPresent());
    assertEquals(transactionManager.getAllTransactionInfos().size(), 1);
    getFutureValue(new RollbackTask().execute(new Rollback(), transactionManager, metadata, new AllowAllAccessControl(), stateMachine, emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())));
    assertTrue(stateMachine.getQueryInfo(Optional.empty()).isClearTransactionId());
    assertFalse(stateMachine.getQueryInfo(Optional.empty()).getStartedTransactionId().isPresent());
    assertTrue(transactionManager.getAllTransactionInfos().isEmpty());
}
Also used : TransactionManager(io.prestosql.transaction.TransactionManager) InMemoryTransactionManager.createTestTransactionManager(io.prestosql.transaction.InMemoryTransactionManager.createTestTransactionManager) AllowAllAccessControl(io.prestosql.security.AllowAllAccessControl) HeuristicIndexerManager(io.prestosql.heuristicindex.HeuristicIndexerManager) Rollback(io.prestosql.sql.tree.Rollback) HetuMetaStoreManager(io.prestosql.metastore.HetuMetaStoreManager) Session(io.prestosql.Session) FileSystemClientManager(io.prestosql.filesystem.FileSystemClientManager) Test(org.testng.annotations.Test)

Example 25 with HeuristicIndexerManager

use of io.prestosql.heuristicindex.HeuristicIndexerManager in project hetu-core by openlookeng.

the class TestSetSessionTask method testSetSessionWithParameters.

private void testSetSessionWithParameters(String property, Expression expression, String expectedValue, List<Expression> parameters) {
    QualifiedName qualifiedPropName = QualifiedName.of(CATALOG_NAME, property);
    QueryStateMachine stateMachine = QueryStateMachine.begin(format("set %s = 'old_value'", qualifiedPropName), Optional.empty(), TEST_SESSION, URI.create("fake://uri"), new ResourceGroupId("test"), new NoOpResourceGroupManager(), false, transactionManager, accessControl, executor, metadata, WarningCollector.NOOP);
    getFutureValue(new SetSessionTask().execute(new SetSession(qualifiedPropName, expression), transactionManager, metadata, accessControl, stateMachine, parameters, new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())));
    Map<String, String> sessionProperties = stateMachine.getSetSessionProperties();
    assertEquals(sessionProperties, ImmutableMap.of(qualifiedPropName.toString(), expectedValue));
}
Also used : ResourceGroupId(io.prestosql.spi.resourcegroups.ResourceGroupId) SetSession(io.prestosql.sql.tree.SetSession) QualifiedName(io.prestosql.sql.tree.QualifiedName) HeuristicIndexerManager(io.prestosql.heuristicindex.HeuristicIndexerManager) HetuMetaStoreManager(io.prestosql.metastore.HetuMetaStoreManager) NoOpResourceGroupManager(io.prestosql.execution.resourcegroups.NoOpResourceGroupManager) FileSystemClientManager(io.prestosql.filesystem.FileSystemClientManager)

Aggregations

HeuristicIndexerManager (io.prestosql.heuristicindex.HeuristicIndexerManager)33 HetuMetaStoreManager (io.prestosql.metastore.HetuMetaStoreManager)26 FileSystemClientManager (io.prestosql.filesystem.FileSystemClientManager)25 Session (io.prestosql.Session)22 TransactionManager (io.prestosql.transaction.TransactionManager)19 AllowAllAccessControl (io.prestosql.security.AllowAllAccessControl)18 Test (org.testng.annotations.Test)17 InMemoryTransactionManager.createTestTransactionManager (io.prestosql.transaction.InMemoryTransactionManager.createTestTransactionManager)15 List (java.util.List)9 Metadata (io.prestosql.metadata.Metadata)8 Optional (java.util.Optional)7 ImmutableList (com.google.common.collect.ImmutableList)6 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)6 StartTransaction (io.prestosql.sql.tree.StartTransaction)6 InMemoryTransactionManager (io.prestosql.transaction.InMemoryTransactionManager)6 CubeManager (io.prestosql.cube.CubeManager)5 NoOpResourceGroupManager (io.prestosql.execution.resourcegroups.NoOpResourceGroupManager)5 AccessControl (io.prestosql.security.AccessControl)5 ResourceGroupId (io.prestosql.spi.resourcegroups.ResourceGroupId)5 Expression (io.prestosql.sql.tree.Expression)5