use of com.facebook.presto.spi.connector.ConnectorMetadata in project presto by prestodb.
the class AccumuloConnector method getMetadata.
@Override
public ConnectorMetadata getMetadata(ConnectorTransactionHandle transactionHandle) {
ConnectorMetadata metadata = transactions.get(transactionHandle);
checkArgument(metadata != null, "no such transaction: %s", transactionHandle);
return metadata;
}
use of com.facebook.presto.spi.connector.ConnectorMetadata in project presto by prestodb.
the class HiveConnector method getMetadata.
@Override
public ConnectorMetadata getMetadata(ConnectorTransactionHandle transaction) {
ConnectorMetadata metadata = transactionManager.get(transaction);
checkArgument(metadata != null, "no such transaction: %s", transaction);
return new ClassLoaderSafeConnectorMetadata(metadata, classLoader);
}
use of com.facebook.presto.spi.connector.ConnectorMetadata in project presto by prestodb.
the class HiveTransactionManager method put.
public void put(ConnectorTransactionHandle transactionHandle, ConnectorMetadata metadata) {
ConnectorMetadata previousValue = transactions.putIfAbsent(transactionHandle, metadata);
checkState(previousValue == null);
}
use of com.facebook.presto.spi.connector.ConnectorMetadata in project presto by prestodb.
the class TestTransactionManager method testTransactionWorkflow.
@Test
public void testTransactionWorkflow() throws Exception {
try (IdleCheckExecutor executor = new IdleCheckExecutor()) {
CatalogManager catalogManager = new CatalogManager();
TransactionManager transactionManager = TransactionManager.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.asyncCommit(transactionId));
assertTrue(transactionManager.getAllTransactionInfos().isEmpty());
}
}
use of com.facebook.presto.spi.connector.ConnectorMetadata in project presto by prestodb.
the class MetadataManager method createView.
@Override
public void createView(Session session, QualifiedObjectName viewName, String viewData, boolean replace) {
CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, viewName.getCatalogName());
ConnectorId connectorId = catalogMetadata.getConnectorId();
ConnectorMetadata metadata = catalogMetadata.getMetadata();
metadata.createView(session.toConnectorSession(connectorId), viewName.asSchemaTableName(), viewData, replace);
}
Aggregations