prestodb/presto · error · PrestoException
NODE_SELECTION_NOT_SUPPORTED
NODE_SELECTION_NOT_SUPPORTED
Error message
Unsupported node selection strategy %s
What it means
NodePartitioningManager.getNodePartitioningMap computes how buckets map to nodes for a connector's partitioning handle. When the connector's NodeSelectionStrategy is not one of the supported values (HARD_AFFINITY, SOFT_AFFINITY, etc.), the default branch throws NODE_SELECTION_NOT_SUPPORTED, indicating a connector returned a strategy the engine cannot distribute work for.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/planner/NodePartitioningManager.java:171
NodeSelectionStrategy nodeSelectionStrategy = connectorBucketNodeMap.getNodeSelectionStrategy();
boolean cacheable;
switch (nodeSelectionStrategy) {
case HARD_AFFINITY:
bucketToNode = getFixedMapping(connectorBucketNodeMap);
cacheable = false;
break;
case SOFT_AFFINITY:
bucketToNode = getFixedMapping(connectorBucketNodeMap);
cacheable = true;
break;
case NO_PREFERENCE:
bucketToNode = createArbitraryBucketToNode(
nodeScheduler.createNodeSelector(session, connectorId).selectRandomNodes(getMaxTasksPerStage(session)),
connectorBucketNodeMap.getBucketCount());
cacheable = false;
break;
default:
throw new PrestoException(NODE_SELECTION_NOT_SUPPORTED, format("Unsupported node selection strategy %s", nodeSelectionStrategy));
}
int[] bucketToPartition = new int[connectorBucketNodeMap.getBucketCount()];
BiMap<InternalNode, Integer> nodeToPartition = HashBiMap.create();
int nextPartitionId = 0;
for (int bucket = 0; bucket < bucketToNode.size(); bucket++) {
InternalNode node = bucketToNode.get(bucket);
Integer partitionId = nodeToPartition.get(node);
if (partitionId == null) {
partitionId = nextPartitionId++;
nodeToPartition.put(node, partitionId);
}
bucketToPartition[bucket] = partitionId;
}
List<InternalNode> partitionToNode = IntStream.range(0, nodeToPartition.size())
.mapToObj(partitionId -> nodeToPartition.inverse().get(partitionId))
.collect(toImmutableList());View on GitHub (pinned to 55bb57d202)
Solutions
- Check the connector's configured node selection strategy and switch to a supported one (hard/soft affinity or arbitrary)
- Upgrade or align the connector plugin version with the Presto engine version so enum values match
- Inspect NodePartitioningManager.getNodePartitioningMap switch and add/patch handling if you own a custom connector
- Review the catalog properties for the connector for erroneous partitioning configuration
Example fix
// before (custom connector) return NodeSelectionStrategy.UNKNOWN; // after return NodeSelectionStrategy.HARD_AFFINITY;
Defensive patterns
Strategy: validation
Validate before calling
// Before issuing queries through the catalog, check the connector's node selection strategy
String strategy = connectorMetadata.getNodeSelectionStrategy().name();
Set<String> supported = Set.of("HARD_AFFINITY", "SOFT_AFFINITY", "ARBITRARY");
if (!supported.contains(strategy)) {
throw new IllegalStateException("Unsupported node selection strategy: " + strategy);
} Type guard
boolean isSupportedStrategy(NodeSelectionStrategy s) {
return s == NodeSelectionStrategy.HARD_AFFINITY
|| s == NodeSelectionStrategy.SOFT_AFFINITY
|| s == NodeSelectionStrategy.ARBITRARY;
} Try / catch
try {
runQuery(sql);
} catch (PrestoException e) {
if (e.getErrorCode().getName().equals("NODE_SELECTION_NOT_SUPPORTED")) {
throw new IllegalStateException("Connector uses an unsupported node selection strategy: " + e.getMessage(), e);
}
throw e;
} Prevention
- Keep connector plugin versions aligned with the Presto engine version
- Verify catalog configuration declares a supported node selection strategy
- Test bucketed queries against custom connectors before production rollout
- Watch engine upgrade notes for NodeSelectionStrategy enum changes
When it happens
Trigger: A connector's ConnectorNodePartitioningProvider returns a NodeSelectionStrategy value from its getConnectorNodeSelectionStrategy that falls into the default branch of the switch in getNodePartitioningMap (e.g. a newly added enum constant not handled by the engine, or a custom connector returning an unexpected strategy).
Common situations: Custom/third-party connector reporting an unsupported or new node selection strategy; version mismatch between connector plugin and Presto engine after an enum was extended; misconfigured connector catalog exposing a strategy the engine build doesn't handle.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/89bfeff772d182e1.
Report an issue: GitHub.