Search in sources :

Example 1 with ConnectorPartitioningHandle

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

the class MetadataManager method getCommonPartitioning.

@Override
public Optional<PartitioningHandle> getCommonPartitioning(Session session, PartitioningHandle left, PartitioningHandle right) {
    Optional<CatalogName> leftConnectorId = left.getConnectorId();
    Optional<CatalogName> rightConnectorId = right.getConnectorId();
    if (!leftConnectorId.isPresent() || !rightConnectorId.isPresent() || !leftConnectorId.equals(rightConnectorId)) {
        return Optional.empty();
    }
    if (!left.getTransactionHandle().equals(right.getTransactionHandle())) {
        return Optional.empty();
    }
    CatalogName catalogName = leftConnectorId.get();
    CatalogMetadata catalogMetadata = getCatalogMetadata(session, catalogName);
    ConnectorMetadata metadata = catalogMetadata.getMetadataFor(catalogName);
    Optional<ConnectorPartitioningHandle> commonHandle = metadata.getCommonPartitioningHandle(session.toConnectorSession(catalogName), left.getConnectorHandle(), right.getConnectorHandle());
    return commonHandle.map(handle -> new PartitioningHandle(Optional.of(catalogName), left.getTransactionHandle(), handle));
}
Also used : ConnectorPartitioningHandle(io.prestosql.spi.connector.ConnectorPartitioningHandle) CatalogName(io.prestosql.spi.connector.CatalogName) ConnectorMetadata(io.prestosql.spi.connector.ConnectorMetadata) ConnectorPartitioningHandle(io.prestosql.spi.connector.ConnectorPartitioningHandle) PartitioningHandle(io.prestosql.sql.planner.PartitioningHandle)

Aggregations

CatalogName (io.prestosql.spi.connector.CatalogName)1 ConnectorMetadata (io.prestosql.spi.connector.ConnectorMetadata)1 ConnectorPartitioningHandle (io.prestosql.spi.connector.ConnectorPartitioningHandle)1 PartitioningHandle (io.prestosql.sql.planner.PartitioningHandle)1