use of com.facebook.presto.connector.ConnectorId in project presto by prestodb.
the class MetadataManager method getColumnHandles.
@Override
public Map<String, ColumnHandle> getColumnHandles(Session session, TableHandle tableHandle) {
ConnectorId connectorId = tableHandle.getConnectorId();
ConnectorMetadata metadata = getMetadata(session, connectorId);
Map<String, ColumnHandle> handles = metadata.getColumnHandles(session.toConnectorSession(connectorId), tableHandle.getConnectorHandle());
ImmutableMap.Builder<String, ColumnHandle> map = ImmutableMap.builder();
for (Entry<String, ColumnHandle> mapEntry : handles.entrySet()) {
map.put(mapEntry.getKey().toLowerCase(ENGLISH), mapEntry.getValue());
}
return map.build();
}
use of com.facebook.presto.connector.ConnectorId in project presto by prestodb.
the class MetadataManager method getInfo.
@Override
public Optional<Object> getInfo(Session session, TableLayoutHandle handle) {
ConnectorId connectorId = handle.getConnectorId();
ConnectorMetadata metadata = getMetadata(session, connectorId);
ConnectorTableLayout tableLayout = metadata.getTableLayout(session.toConnectorSession(connectorId), handle.getConnectorHandle());
return metadata.getInfo(tableLayout.getHandle());
}
use of com.facebook.presto.connector.ConnectorId in project presto by prestodb.
the class MetadataManager method listTables.
@Override
public List<QualifiedObjectName> listTables(Session session, QualifiedTablePrefix prefix) {
requireNonNull(prefix, "prefix is null");
Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, prefix.getCatalogName());
Set<QualifiedObjectName> tables = new LinkedHashSet<>();
if (catalog.isPresent()) {
CatalogMetadata catalogMetadata = catalog.get();
String schemaNameOrNull = prefix.getSchemaName().orElse(null);
for (ConnectorId connectorId : catalogMetadata.listConnectorIds()) {
ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId);
ConnectorSession connectorSession = session.toConnectorSession(connectorId);
metadata.listTables(connectorSession, schemaNameOrNull).stream().map(convertFromSchemaTableName(prefix.getCatalogName())::apply).forEach(tables::add);
}
}
return ImmutableList.copyOf(tables);
}
use of com.facebook.presto.connector.ConnectorId in project presto by prestodb.
the class MetadataManager method getColumnMetadata.
@Override
public ColumnMetadata getColumnMetadata(Session session, TableHandle tableHandle, ColumnHandle columnHandle) {
requireNonNull(tableHandle, "tableHandle is null");
requireNonNull(columnHandle, "columnHandle is null");
ConnectorId connectorId = tableHandle.getConnectorId();
ConnectorMetadata metadata = getMetadata(session, connectorId);
return metadata.getColumnMetadata(session.toConnectorSession(connectorId), tableHandle.getConnectorHandle(), columnHandle);
}
use of com.facebook.presto.connector.ConnectorId in project presto by prestodb.
the class MetadataManager method renameSchema.
@Override
public void renameSchema(Session session, CatalogSchemaName source, String target) {
CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, source.getCatalogName());
ConnectorId connectorId = catalogMetadata.getConnectorId();
ConnectorMetadata metadata = catalogMetadata.getMetadata();
metadata.renameSchema(session.toConnectorSession(connectorId), source.getSchemaName(), target);
}
Aggregations