Search in sources :

Example 16 with ConnectorMetadata

use of io.prestosql.spi.connector.ConnectorMetadata 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 17 with ConnectorMetadata

use of io.prestosql.spi.connector.ConnectorMetadata 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 18 with ConnectorMetadata

use of io.prestosql.spi.connector.ConnectorMetadata 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 19 with ConnectorMetadata

use of io.prestosql.spi.connector.ConnectorMetadata 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 20 with ConnectorMetadata

use of io.prestosql.spi.connector.ConnectorMetadata 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

ConnectorMetadata (io.prestosql.spi.connector.ConnectorMetadata)235 ConnectorSession (io.prestosql.spi.connector.ConnectorSession)126 Test (org.testng.annotations.Test)109 ConnectorTableHandle (io.prestosql.spi.connector.ConnectorTableHandle)103 TestingConnectorSession (io.prestosql.testing.TestingConnectorSession)96 CatalogName (io.prestosql.spi.connector.CatalogName)80 SchemaTableName (io.prestosql.spi.connector.SchemaTableName)63 ColumnHandle (io.prestosql.spi.connector.ColumnHandle)53 ConnectorTableMetadata (io.prestosql.spi.connector.ConnectorTableMetadata)52 HiveColumnHandle.bucketColumnHandle (io.prestosql.plugin.hive.HiveColumnHandle.bucketColumnHandle)44 ColumnMetadata (io.prestosql.spi.connector.ColumnMetadata)42 MaterializedResult (io.prestosql.testing.MaterializedResult)42 ConnectorInsertTableHandle (io.prestosql.spi.connector.ConnectorInsertTableHandle)41 ConnectorOutputTableHandle (io.prestosql.spi.connector.ConnectorOutputTableHandle)37 Constraint (io.prestosql.spi.connector.Constraint)35 Slice (io.airlift.slice.Slice)32 Path (org.apache.hadoop.fs.Path)32 PrestoException (io.prestosql.spi.PrestoException)31 HdfsContext (io.prestosql.plugin.hive.HdfsEnvironment.HdfsContext)30 ConnectorPageSink (io.prestosql.spi.connector.ConnectorPageSink)30