Search in sources :

Example 26 with ConnectorMetadata

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

the class MetadataManager method dropTable.

@Override
public void dropTable(Session session, TableHandle tableHandle) {
    CatalogName catalogName = tableHandle.getCatalogName();
    ConnectorMetadata metadata = getMetadataForWrite(session, catalogName);
    metadata.dropTable(session.toConnectorSession(catalogName), tableHandle.getConnectorHandle());
}
Also used : CatalogName(io.prestosql.spi.connector.CatalogName) ConnectorMetadata(io.prestosql.spi.connector.ConnectorMetadata)

Example 27 with ConnectorMetadata

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

the class MetadataManager method isExecutionPlanCacheSupported.

/**
 * Hetu can only cache execution plans for supported connectors.
 * This method checks if the property for supporting execution plan caching is enabled for a given connector.
 *
 * @param session Presto session
 * @param table table handle containing a ConnectorTableHandle
 */
@Override
public boolean isExecutionPlanCacheSupported(Session session, TableHandle table) {
    CatalogName catalogName = table.getCatalogName();
    ConnectorMetadata metadata = getMetadata(session, catalogName);
    return metadata.isExecutionPlanCacheSupported(session.toConnectorSession(), table.getConnectorHandle());
}
Also used : CatalogName(io.prestosql.spi.connector.CatalogName) ConnectorMetadata(io.prestosql.spi.connector.ConnectorMetadata)

Example 28 with ConnectorMetadata

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

the class MetadataManager method createTable.

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

Example 29 with ConnectorMetadata

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

the class MetadataManager method beginInsert.

@Override
public InsertTableHandle beginInsert(Session session, TableHandle tableHandle, boolean isOverwrite) {
    CatalogName catalogName = tableHandle.getCatalogName();
    CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, catalogName);
    ConnectorMetadata metadata = catalogMetadata.getMetadata();
    ConnectorTransactionHandle transactionHandle = catalogMetadata.getTransactionHandleFor(catalogName);
    ConnectorInsertTableHandle handle;
    if (isOverwrite) {
        handle = metadata.beginInsert(session.toConnectorSession(catalogName), tableHandle.getConnectorHandle(), true);
    } else {
        handle = metadata.beginInsert(session.toConnectorSession(catalogName), tableHandle.getConnectorHandle());
    }
    return new InsertTableHandle(tableHandle.getCatalogName(), transactionHandle, handle);
}
Also used : ConnectorInsertTableHandle(io.prestosql.spi.connector.ConnectorInsertTableHandle) ConnectorTransactionHandle(io.prestosql.spi.connector.ConnectorTransactionHandle) CatalogName(io.prestosql.spi.connector.CatalogName) ConnectorMetadata(io.prestosql.spi.connector.ConnectorMetadata) ConnectorDeleteAsInsertTableHandle(io.prestosql.spi.connector.ConnectorDeleteAsInsertTableHandle) ConnectorInsertTableHandle(io.prestosql.spi.connector.ConnectorInsertTableHandle)

Example 30 with ConnectorMetadata

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

the class MetadataManager method getNewTableLayout.

@Override
public Optional<NewTableLayout> getNewTableLayout(Session session, String catalogName, ConnectorTableMetadata tableMetadata) {
    CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, catalogName);
    CatalogName catalog = catalogMetadata.getCatalogName();
    ConnectorMetadata metadata = catalogMetadata.getMetadata();
    ConnectorTransactionHandle transactionHandle = catalogMetadata.getTransactionHandleFor(catalog);
    ConnectorSession connectorSession = session.toConnectorSession(catalog);
    return metadata.getNewTableLayout(connectorSession, tableMetadata).map(layout -> new NewTableLayout(catalog, transactionHandle, layout));
}
Also used : ConnectorTransactionHandle(io.prestosql.spi.connector.ConnectorTransactionHandle) CatalogName(io.prestosql.spi.connector.CatalogName) ConnectorSession(io.prestosql.spi.connector.ConnectorSession) ConnectorMetadata(io.prestosql.spi.connector.ConnectorMetadata)

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