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());
}
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;
}
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());
}
Aggregations