use of com.facebook.presto.spi.ConnectorId in project presto by prestodb.
the class MetadataManager method renameColumn.
@Override
public void renameColumn(Session session, TableHandle tableHandle, ColumnHandle source, String target) {
ConnectorId connectorId = tableHandle.getConnectorId();
ConnectorMetadata metadata = getMetadataForWrite(session, connectorId);
metadata.renameColumn(session.toConnectorSession(connectorId), tableHandle.getConnectorHandle(), source, target.toLowerCase(ENGLISH));
}
use of com.facebook.presto.spi.ConnectorId in project presto by prestodb.
the class MetadataManager method createTable.
@Override
public void createTable(Session session, String catalogName, ConnectorTableMetadata tableMetadata, boolean ignoreExisting) {
CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, catalogName);
ConnectorId connectorId = catalogMetadata.getConnectorId();
ConnectorMetadata metadata = catalogMetadata.getMetadata();
metadata.createTable(session.toConnectorSession(connectorId), tableMetadata, ignoreExisting);
}
use of com.facebook.presto.spi.ConnectorId in project presto by prestodb.
the class MetadataManager method getInsertLayout.
@Override
public Optional<NewTableLayout> getInsertLayout(Session session, TableHandle table) {
ConnectorId connectorId = table.getConnectorId();
CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, connectorId);
ConnectorMetadata metadata = catalogMetadata.getMetadata();
return metadata.getInsertLayout(session.toConnectorSession(connectorId), table.getConnectorHandle()).map(layout -> new NewTableLayout(connectorId, catalogMetadata.getTransactionHandleFor(connectorId), layout));
}
use of com.facebook.presto.spi.ConnectorId in project presto by prestodb.
the class MetadataManager method getInfo.
@Override
public Optional<Object> getInfo(Session session, TableHandle handle) {
ConnectorId connectorId = handle.getConnectorId();
ConnectorMetadata metadata = getMetadata(session, connectorId);
return handle.getLayout().flatMap(tableLayout -> metadata.getInfo(tableLayout));
}
use of com.facebook.presto.spi.ConnectorId in project presto by prestodb.
the class MetadataManager method getTableHandleForStatisticsCollection.
@Override
public Optional<TableHandle> getTableHandleForStatisticsCollection(Session session, QualifiedObjectName table, Map<String, Object> analyzeProperties) {
requireNonNull(table, "table is null");
Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, table.getCatalogName());
if (catalog.isPresent()) {
CatalogMetadata catalogMetadata = catalog.get();
ConnectorId connectorId = catalogMetadata.getConnectorId(session, table);
ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId);
ConnectorTableHandle tableHandle = metadata.getTableHandleForStatisticsCollection(session.toConnectorSession(connectorId), toSchemaTableName(table), analyzeProperties);
if (tableHandle != null) {
return Optional.of(new TableHandle(connectorId, tableHandle, catalogMetadata.getTransactionHandleFor(connectorId), Optional.empty()));
}
}
return Optional.empty();
}
Aggregations