Search in sources :

Example 1 with DynamicBucketNodeMap

use of com.facebook.presto.execution.scheduler.group.DynamicBucketNodeMap in project presto by prestodb.

the class NodePartitioningManager method getBucketNodeMap.

public BucketNodeMap getBucketNodeMap(Session session, PartitioningHandle partitioningHandle, boolean preferDynamic) {
    ConnectorBucketNodeMap connectorBucketNodeMap = getConnectorBucketNodeMap(session, partitioningHandle);
    NodeSelectionStrategy nodeSelectionStrategy = connectorBucketNodeMap.getNodeSelectionStrategy();
    switch(nodeSelectionStrategy) {
        case HARD_AFFINITY:
            return new FixedBucketNodeMap(getSplitToBucket(session, partitioningHandle), getFixedMapping(connectorBucketNodeMap), false);
        case SOFT_AFFINITY:
            if (preferDynamic) {
                return new DynamicBucketNodeMap(getSplitToBucket(session, partitioningHandle), connectorBucketNodeMap.getBucketCount(), getFixedMapping(connectorBucketNodeMap));
            }
            return new FixedBucketNodeMap(getSplitToBucket(session, partitioningHandle), getFixedMapping(connectorBucketNodeMap), true);
        case NO_PREFERENCE:
            if (preferDynamic) {
                return new DynamicBucketNodeMap(getSplitToBucket(session, partitioningHandle), connectorBucketNodeMap.getBucketCount());
            }
            return new FixedBucketNodeMap(getSplitToBucket(session, partitioningHandle), createArbitraryBucketToNode(nodeScheduler.createNodeSelector(session, partitioningHandle.getConnectorId().get()).selectRandomNodes(getMaxTasksPerStage(session)), connectorBucketNodeMap.getBucketCount()), false);
        default:
            throw new PrestoException(NODE_SELECTION_NOT_SUPPORTED, format("Unsupported node selection strategy %s", nodeSelectionStrategy));
    }
}
Also used : DynamicBucketNodeMap(com.facebook.presto.execution.scheduler.group.DynamicBucketNodeMap) ConnectorBucketNodeMap(com.facebook.presto.spi.connector.ConnectorBucketNodeMap) NodeSelectionStrategy(com.facebook.presto.spi.schedule.NodeSelectionStrategy) PrestoException(com.facebook.presto.spi.PrestoException) FixedBucketNodeMap(com.facebook.presto.execution.scheduler.FixedBucketNodeMap)

Aggregations

FixedBucketNodeMap (com.facebook.presto.execution.scheduler.FixedBucketNodeMap)1 DynamicBucketNodeMap (com.facebook.presto.execution.scheduler.group.DynamicBucketNodeMap)1 PrestoException (com.facebook.presto.spi.PrestoException)1 ConnectorBucketNodeMap (com.facebook.presto.spi.connector.ConnectorBucketNodeMap)1 NodeSelectionStrategy (com.facebook.presto.spi.schedule.NodeSelectionStrategy)1