Search in sources :

Example 21 with CatalogName

use of io.prestosql.spi.connector.CatalogName in project hetu-core by openlookeng.

the class MetadataManager method applySample.

@Override
public Optional<TableHandle> applySample(Session session, TableHandle table, SampleType sampleType, double sampleRatio) {
    CatalogName catalogName = table.getCatalogName();
    ConnectorMetadata metadata = getMetadata(session, catalogName);
    if (metadata.usesLegacyTableLayouts()) {
        return Optional.empty();
    }
    ConnectorSession connectorSession = session.toConnectorSession(catalogName);
    return metadata.applySample(connectorSession, table.getConnectorHandle(), sampleType, sampleRatio).map(result -> new TableHandle(catalogName, result, table.getTransaction(), Optional.empty()));
}
Also used : CatalogName(io.prestosql.spi.connector.CatalogName) ConnectorSession(io.prestosql.spi.connector.ConnectorSession) ConnectorVacuumTableHandle(io.prestosql.spi.connector.ConnectorVacuumTableHandle) ConnectorDeleteAsInsertTableHandle(io.prestosql.spi.connector.ConnectorDeleteAsInsertTableHandle) ConnectorUpdateTableHandle(io.prestosql.spi.connector.ConnectorUpdateTableHandle) ConnectorOutputTableHandle(io.prestosql.spi.connector.ConnectorOutputTableHandle) TableHandle(io.prestosql.spi.metadata.TableHandle) ConnectorTableHandle(io.prestosql.spi.connector.ConnectorTableHandle) ConnectorInsertTableHandle(io.prestosql.spi.connector.ConnectorInsertTableHandle) ConnectorMetadata(io.prestosql.spi.connector.ConnectorMetadata)

Example 22 with CatalogName

use of io.prestosql.spi.connector.CatalogName in project hetu-core by openlookeng.

the class MetadataManager method renameSchema.

@Override
public void renameSchema(Session session, CatalogSchemaName source, String target) {
    CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, source.getCatalogName());
    CatalogName catalogName = catalogMetadata.getCatalogName();
    ConnectorMetadata metadata = catalogMetadata.getMetadata();
    metadata.renameSchema(session.toConnectorSession(catalogName), source.getSchemaName(), target);
}
Also used : CatalogName(io.prestosql.spi.connector.CatalogName) ConnectorMetadata(io.prestosql.spi.connector.ConnectorMetadata)

Example 23 with CatalogName

use of io.prestosql.spi.connector.CatalogName in project hetu-core by openlookeng.

the class MetadataManager method createView.

@Override
public void createView(Session session, QualifiedObjectName viewName, ConnectorViewDefinition definition, boolean replace) {
    CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, viewName.getCatalogName());
    CatalogName catalogName = catalogMetadata.getCatalogName();
    ConnectorMetadata metadata = catalogMetadata.getMetadata();
    metadata.createView(session.toConnectorSession(catalogName), toSchemaTableName(viewName), definition, replace);
}
Also used : CatalogName(io.prestosql.spi.connector.CatalogName) ConnectorMetadata(io.prestosql.spi.connector.ConnectorMetadata)

Example 24 with CatalogName

use of io.prestosql.spi.connector.CatalogName in project hetu-core by openlookeng.

the class MetadataManager method getStatisticsCollectionMetadata.

@Override
public TableStatisticsMetadata getStatisticsCollectionMetadata(Session session, String catalogName, ConnectorTableMetadata tableMetadata) {
    CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, catalogName);
    ConnectorMetadata metadata = catalogMetadata.getMetadata();
    CatalogName catalog = catalogMetadata.getCatalogName();
    return metadata.getStatisticsCollectionMetadata(session.toConnectorSession(catalog), tableMetadata);
}
Also used : CatalogName(io.prestosql.spi.connector.CatalogName) ConnectorMetadata(io.prestosql.spi.connector.ConnectorMetadata)

Example 25 with CatalogName

use of io.prestosql.spi.connector.CatalogName in project hetu-core by openlookeng.

the class MetadataManager method beginStatisticsCollection.

@Override
public AnalyzeTableHandle beginStatisticsCollection(Session session, TableHandle tableHandle) {
    CatalogName catalogName = tableHandle.getCatalogName();
    CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, catalogName);
    ConnectorMetadata metadata = catalogMetadata.getMetadata();
    ConnectorTransactionHandle transactionHandle = catalogMetadata.getTransactionHandleFor(catalogName);
    ConnectorTableHandle connectorTableHandle = metadata.beginStatisticsCollection(session.toConnectorSession(catalogName), tableHandle.getConnectorHandle());
    return new AnalyzeTableHandle(catalogName, transactionHandle, connectorTableHandle);
}
Also used : ConnectorTransactionHandle(io.prestosql.spi.connector.ConnectorTransactionHandle) CatalogName(io.prestosql.spi.connector.CatalogName) ConnectorMetadata(io.prestosql.spi.connector.ConnectorMetadata) ConnectorTableHandle(io.prestosql.spi.connector.ConnectorTableHandle)

Aggregations

CatalogName (io.prestosql.spi.connector.CatalogName)155 ConnectorMetadata (io.prestosql.spi.connector.ConnectorMetadata)82 ConnectorSession (io.prestosql.spi.connector.ConnectorSession)32 TableHandle (io.prestosql.spi.metadata.TableHandle)30 PrestoException (io.prestosql.spi.PrestoException)22 ImmutableList (com.google.common.collect.ImmutableList)21 Optional (java.util.Optional)21 Session (io.prestosql.Session)20 QualifiedObjectName (io.prestosql.spi.connector.QualifiedObjectName)20 List (java.util.List)20 HashMap (java.util.HashMap)19 Map (java.util.Map)19 ConnectorDeleteAsInsertTableHandle (io.prestosql.spi.connector.ConnectorDeleteAsInsertTableHandle)18 ConnectorTableHandle (io.prestosql.spi.connector.ConnectorTableHandle)18 ConnectorInsertTableHandle (io.prestosql.spi.connector.ConnectorInsertTableHandle)17 ConnectorOutputTableHandle (io.prestosql.spi.connector.ConnectorOutputTableHandle)17 ConnectorUpdateTableHandle (io.prestosql.spi.connector.ConnectorUpdateTableHandle)17 ConnectorVacuumTableHandle (io.prestosql.spi.connector.ConnectorVacuumTableHandle)17 ConnectorTransactionHandle (io.prestosql.spi.connector.ConnectorTransactionHandle)16 Type (io.prestosql.spi.type.Type)16