use of com.facebook.presto.tpch.TpchConnectorFactory in project presto by prestodb.
the class StatsCalculatorTester method createQueryRunner.
private static LocalQueryRunner createQueryRunner(Session session) {
LocalQueryRunner queryRunner = new LocalQueryRunner(session);
queryRunner.createCatalog(session.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
return queryRunner;
}
use of com.facebook.presto.tpch.TpchConnectorFactory in project presto by prestodb.
the class TestTransactionManager method testFailedTransactionWorkflow.
@Test
public void testFailedTransactionWorkflow() {
try (IdleCheckExecutor executor = new IdleCheckExecutor()) {
CatalogManager catalogManager = new CatalogManager();
TransactionManager transactionManager = InMemoryTransactionManager.create(new TransactionManagerConfig(), executor.getExecutor(), catalogManager, finishingExecutor);
Connector c1 = new TpchConnectorFactory().create(CATALOG_NAME, ImmutableMap.of(), new TestingConnectorContext());
registerConnector(catalogManager, transactionManager, CATALOG_NAME, CONNECTOR_ID, c1);
TransactionId transactionId = transactionManager.beginTransaction(false);
assertEquals(transactionManager.getAllTransactionInfos().size(), 1);
TransactionInfo transactionInfo = transactionManager.getTransactionInfo(transactionId);
assertFalse(transactionInfo.isAutoCommitContext());
assertTrue(transactionInfo.getConnectorIds().isEmpty());
assertFalse(transactionInfo.getWrittenConnectorId().isPresent());
ConnectorMetadata metadata = transactionManager.getOptionalCatalogMetadata(transactionId, CATALOG_NAME).get().getMetadata();
metadata.listSchemaNames(TEST_SESSION.toConnectorSession(CONNECTOR_ID));
transactionInfo = transactionManager.getTransactionInfo(transactionId);
assertEquals(transactionInfo.getConnectorIds(), ImmutableList.of(CONNECTOR_ID, INFORMATION_SCHEMA_ID, SYSTEM_TABLES_ID));
assertFalse(transactionInfo.getWrittenConnectorId().isPresent());
transactionManager.fail(transactionId);
assertEquals(transactionManager.getAllTransactionInfos().size(), 1);
try {
transactionManager.getCatalogMetadata(transactionId, CONNECTOR_ID);
fail();
} catch (PrestoException e) {
assertEquals(e.getErrorCode(), TRANSACTION_ALREADY_ABORTED.toErrorCode());
}
assertEquals(transactionManager.getAllTransactionInfos().size(), 1);
getFutureValue(transactionManager.asyncAbort(transactionId));
assertTrue(transactionManager.getAllTransactionInfos().isEmpty());
}
}
use of com.facebook.presto.tpch.TpchConnectorFactory in project presto by prestodb.
the class TestTransactionManager method testAbortedTransactionWorkflow.
@Test
public void testAbortedTransactionWorkflow() {
try (IdleCheckExecutor executor = new IdleCheckExecutor()) {
CatalogManager catalogManager = new CatalogManager();
TransactionManager transactionManager = InMemoryTransactionManager.create(new TransactionManagerConfig(), executor.getExecutor(), catalogManager, finishingExecutor);
Connector c1 = new TpchConnectorFactory().create(CATALOG_NAME, ImmutableMap.of(), new TestingConnectorContext());
registerConnector(catalogManager, transactionManager, CATALOG_NAME, CONNECTOR_ID, c1);
TransactionId transactionId = transactionManager.beginTransaction(false);
assertEquals(transactionManager.getAllTransactionInfos().size(), 1);
TransactionInfo transactionInfo = transactionManager.getTransactionInfo(transactionId);
assertFalse(transactionInfo.isAutoCommitContext());
assertTrue(transactionInfo.getConnectorIds().isEmpty());
assertFalse(transactionInfo.getWrittenConnectorId().isPresent());
ConnectorMetadata metadata = transactionManager.getOptionalCatalogMetadata(transactionId, CATALOG_NAME).get().getMetadata();
metadata.listSchemaNames(TEST_SESSION.toConnectorSession(CONNECTOR_ID));
transactionInfo = transactionManager.getTransactionInfo(transactionId);
assertEquals(transactionInfo.getConnectorIds(), ImmutableList.of(CONNECTOR_ID, INFORMATION_SCHEMA_ID, SYSTEM_TABLES_ID));
assertFalse(transactionInfo.getWrittenConnectorId().isPresent());
getFutureValue(transactionManager.asyncAbort(transactionId));
assertTrue(transactionManager.getAllTransactionInfos().isEmpty());
}
}
use of com.facebook.presto.tpch.TpchConnectorFactory in project presto by prestodb.
the class TestPlannerWarnings method setUp.
@BeforeClass
public void setUp() {
queryRunner = new LocalQueryRunner(testSessionBuilder().setCatalog("local").setSchema("tiny").build());
queryRunner.createCatalog(queryRunner.getDefaultSession().getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
}
use of com.facebook.presto.tpch.TpchConnectorFactory in project presto by prestodb.
the class TestLocalExecutionPlanner method setUp.
@BeforeClass
public void setUp() {
runner = new LocalQueryRunner(TEST_SESSION);
runner.createCatalog(runner.getDefaultSession().getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
}
Aggregations