use of com.facebook.presto.spi.connector.ConnectorMetadata in project presto by prestodb.
the class AbstractTestHiveClientS3 method testGetRecordsS3.
@Test
public void testGetRecordsS3() throws Exception {
try (Transaction transaction = newTransaction()) {
ConnectorMetadata metadata = transaction.getMetadata();
ConnectorSession session = newSession();
ConnectorTableHandle table = getTableHandle(metadata, tableS3);
List<ColumnHandle> columnHandles = ImmutableList.copyOf(metadata.getColumnHandles(session, table).values());
Map<String, Integer> columnIndex = indexColumns(columnHandles);
List<ConnectorTableLayoutResult> tableLayoutResults = metadata.getTableLayouts(session, table, new Constraint<>(TupleDomain.all(), bindings -> true), Optional.empty());
HiveTableLayoutHandle layoutHandle = (HiveTableLayoutHandle) getOnlyElement(tableLayoutResults).getTableLayout().getHandle();
assertEquals(layoutHandle.getPartitions().get().size(), 1);
ConnectorSplitSource splitSource = splitManager.getSplits(transaction.getTransactionHandle(), session, layoutHandle);
long sum = 0;
for (ConnectorSplit split : getAllSplits(splitSource)) {
try (ConnectorPageSource pageSource = pageSourceProvider.createPageSource(transaction.getTransactionHandle(), session, split, columnHandles)) {
MaterializedResult result = materializeSourceDataStream(session, pageSource, getTypes(columnHandles));
for (MaterializedRow row : result) {
sum += (Long) row.getField(columnIndex.get("t_bigint"));
}
}
}
assertEquals(sum, 78300);
}
}
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 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