Search in sources :

Example 1 with ConnectorTableLayoutHandle

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

the class MetadataManager method getInfo.

@Override
public Optional<Object> getInfo(Session session, TableHandle handle) {
    CatalogName catalogName = handle.getCatalogName();
    ConnectorMetadata metadata = getMetadata(session, catalogName);
    if (usesLegacyTableLayouts(session, handle)) {
        ConnectorTableLayoutHandle layoutHandle = handle.getLayout().orElseGet(() -> getLayout(session, handle, Constraint.alwaysTrue(), Optional.empty()).get().getNewTableHandle().getLayout().get());
        return metadata.getInfo(layoutHandle);
    }
    return metadata.getInfo(handle.getConnectorHandle());
}
Also used : ConnectorTableLayoutHandle(io.prestosql.spi.connector.ConnectorTableLayoutHandle) CatalogName(io.prestosql.spi.connector.CatalogName) ConnectorMetadata(io.prestosql.spi.connector.ConnectorMetadata)

Example 2 with ConnectorTableLayoutHandle

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

the class SplitManager method getSplits.

public SplitSource getSplits(Session session, TableHandle table, SplitSchedulingStrategy splitSchedulingStrategy, Supplier<List<Set<DynamicFilter>>> dynamicFilterSupplier, Optional<QueryType> queryType, Map<String, Object> queryInfo, Set<TupleDomain<ColumnMetadata>> userDefinedCachePredicates, boolean partOfReuse, PlanNodeId nodeId) {
    MarkerAnnouncer announcer = null;
    if (SystemSessionProperties.isSnapshotEnabled(session)) {
        announcer = getMarkerAnnouncer(session);
        SplitSource splitSource = announcer.getSplitSource(nodeId);
        if (splitSource != null) {
            return splitSource;
        }
    }
    CatalogName catalogName = table.getCatalogName();
    ConnectorSplitManager splitManager = getConnectorSplitManager(catalogName);
    ConnectorSession connectorSession = session.toConnectorSession(catalogName);
    ConnectorSplitSource source;
    if (metadata.usesLegacyTableLayouts(session, table)) {
        ConnectorTableLayoutHandle layout = table.getLayout().orElseGet(() -> metadata.getLayout(session, table, Constraint.alwaysTrue(), Optional.empty()).get().getNewTableHandle().getLayout().get());
        source = splitManager.getSplits(table.getTransaction(), connectorSession, layout, splitSchedulingStrategy);
    } else {
        source = splitManager.getSplits(table.getTransaction(), connectorSession, table.getConnectorHandle(), splitSchedulingStrategy, dynamicFilterSupplier, queryType, queryInfo, userDefinedCachePredicates, partOfReuse);
    }
    SplitSource splitSource = new ConnectorAwareSplitSource(catalogName, source);
    if (minScheduleSplitBatchSize > 1) {
        splitSource = new BufferingSplitSource(splitSource, minScheduleSplitBatchSize);
    }
    if (SystemSessionProperties.isSnapshotEnabled(session)) {
        splitSource = announcer.createMarkerSplitSource(splitSource, nodeId);
    }
    return splitSource;
}
Also used : MarkerAnnouncer(io.prestosql.snapshot.MarkerAnnouncer) ConnectorTableLayoutHandle(io.prestosql.spi.connector.ConnectorTableLayoutHandle) ConnectorSplitManager(io.prestosql.spi.connector.ConnectorSplitManager) CatalogName(io.prestosql.spi.connector.CatalogName) ConnectorSession(io.prestosql.spi.connector.ConnectorSession) ConnectorSplitSource(io.prestosql.spi.connector.ConnectorSplitSource) ConnectorSplitSource(io.prestosql.spi.connector.ConnectorSplitSource)

Example 3 with ConnectorTableLayoutHandle

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

the class MetadataManager method makeCompatiblePartitioning.

@Override
public TableHandle makeCompatiblePartitioning(Session session, TableHandle tableHandle, PartitioningHandle partitioningHandle) {
    checkArgument(partitioningHandle.getConnectorId().isPresent(), "Expect partitioning handle from connector, got system partitioning handle");
    CatalogName catalogName = partitioningHandle.getConnectorId().get();
    checkArgument(catalogName.equals(tableHandle.getCatalogName()), "ConnectorId of tableHandle and partitioningHandle does not match");
    CatalogMetadata catalogMetadata = getCatalogMetadata(session, catalogName);
    ConnectorMetadata metadata = catalogMetadata.getMetadataFor(catalogName);
    ConnectorTransactionHandle transaction = catalogMetadata.getTransactionHandleFor(catalogName);
    if (metadata.usesLegacyTableLayouts()) {
        ConnectorTableLayoutHandle newTableLayoutHandle = metadata.makeCompatiblePartitioning(session.toConnectorSession(catalogName), tableHandle.getLayout().get(), partitioningHandle.getConnectorHandle());
        return new TableHandle(catalogName, tableHandle.getConnectorHandle(), transaction, Optional.of(newTableLayoutHandle));
    }
    verify(!tableHandle.getLayout().isPresent(), "layout should not be present");
    ConnectorTableHandle newTableHandle = metadata.makeCompatiblePartitioning(session.toConnectorSession(catalogName), tableHandle.getConnectorHandle(), partitioningHandle.getConnectorHandle());
    return new TableHandle(catalogName, newTableHandle, transaction, Optional.empty());
}
Also used : ConnectorTableLayoutHandle(io.prestosql.spi.connector.ConnectorTableLayoutHandle) ConnectorTransactionHandle(io.prestosql.spi.connector.ConnectorTransactionHandle) CatalogName(io.prestosql.spi.connector.CatalogName) 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) ConnectorTableHandle(io.prestosql.spi.connector.ConnectorTableHandle)

Aggregations

CatalogName (io.prestosql.spi.connector.CatalogName)3 ConnectorTableLayoutHandle (io.prestosql.spi.connector.ConnectorTableLayoutHandle)3 ConnectorMetadata (io.prestosql.spi.connector.ConnectorMetadata)2 MarkerAnnouncer (io.prestosql.snapshot.MarkerAnnouncer)1 ConnectorDeleteAsInsertTableHandle (io.prestosql.spi.connector.ConnectorDeleteAsInsertTableHandle)1 ConnectorInsertTableHandle (io.prestosql.spi.connector.ConnectorInsertTableHandle)1 ConnectorOutputTableHandle (io.prestosql.spi.connector.ConnectorOutputTableHandle)1 ConnectorSession (io.prestosql.spi.connector.ConnectorSession)1 ConnectorSplitManager (io.prestosql.spi.connector.ConnectorSplitManager)1 ConnectorSplitSource (io.prestosql.spi.connector.ConnectorSplitSource)1 ConnectorTableHandle (io.prestosql.spi.connector.ConnectorTableHandle)1 ConnectorTransactionHandle (io.prestosql.spi.connector.ConnectorTransactionHandle)1 ConnectorUpdateTableHandle (io.prestosql.spi.connector.ConnectorUpdateTableHandle)1 ConnectorVacuumTableHandle (io.prestosql.spi.connector.ConnectorVacuumTableHandle)1 TableHandle (io.prestosql.spi.metadata.TableHandle)1