prestodb/presto · error · PrestoException

NODE_SELECTION_NOT_SUPPORTED

NODE_SELECTION_NOT_SUPPORTED

Error message

Unsupported node selection strategy %s

What it means

getBucketNodeMap builds a ConnectorBucketNodeMap using the session's node selection strategy. Only HARD_AFFINITY, SOFT_AFFINITY, and NO_PREFERENCE are supported; any other strategy throws PrestoException NODE_SELECTION_NOT_SUPPORTED.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveNodePartitioningProvider.java:81

            default:
                throw new IllegalArgumentException("Unsupported bucket function type " + bucketFunctionType);
        }
    }

    @Override
    public ConnectorBucketNodeMap getBucketNodeMap(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle, List<Node> sortedNodes)
    {
        HivePartitioningHandle handle = (HivePartitioningHandle) partitioningHandle;
        NodeSelectionStrategy nodeSelectionStrategy = getNodeSelectionStrategy(session);
        int bucketCount = handle.getBucketCount();
        switch (nodeSelectionStrategy) {
            case HARD_AFFINITY:
            case SOFT_AFFINITY:
                return createBucketNodeMap(Stream.generate(() -> sortedNodes).flatMap(List::stream).limit(bucketCount).collect(toImmutableList()), nodeSelectionStrategy);
            case NO_PREFERENCE:
                return createBucketNodeMap(bucketCount);
            default:
                throw new PrestoException(NODE_SELECTION_NOT_SUPPORTED, format("Unsupported node selection strategy %s", nodeSelectionStrategy));
        }
    }

    @Override
    public ToIntFunction<ConnectorSplit> getSplitBucketFunction(
            ConnectorTransactionHandle transactionHandle,
            ConnectorSession session,
            ConnectorPartitioningHandle partitioningHandle)
    {
        return value -> ((HiveSplit) value).getReadBucketNumber()
                .orElseThrow(() -> new IllegalArgumentException("Bucket number not set in split"));
    }

    @Override
    public int getBucketCount(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle)
    {
        HivePartitioningHandle handle = (HivePartitioningHandle) partitioningHandle;
        return handle.getBucketCount();

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Change the node selection strategy configuration to HARD_AFFINITY, SOFT_AFFINITY, or NO_PREFERENCE.
  2. Check catalog configuration files (hive.properties) for typos in strategy-related properties.
  3. If a custom scheduler sets the strategy, update it to emit a supported value or upgrade the hive connector to one supporting it.

Example fix

// before (hive.properties)
hive.node-selection-strategy=DISK_AWARE
// after
hive.node-selection-strategy=SOFT_AFFINITY
Defensive patterns

Strategy: validation

Validate before calling

Set<String> supported = Set.of("HARD_AFFINITY", "SOFT_AFFINITY", "NO_PREFERENCE");
if (!supported.contains(strategyName.toUpperCase())) {
    throw new IllegalStateException("Unsupported node selection strategy: " + strategyName);
}

Type guard

boolean isSupportedNodeSelectionStrategy(Object s) { return s == NodeSelectionStrategy.HARD_AFFINITY || s == NodeSelectionStrategy.SOFT_AFFINITY || s == NodeSelectionStrategy.NO_PREFERENCE; }

Try / catch

try { planBucketedQuery(...); } catch (PrestoException e) { if (e.getErrorCode().getCode() == StandardErrorCode.NODE_SELECTION_NOT_SUPPORTED.getCode()) { /* fix strategy config and re-run */ } else throw e; }

Prevention

When it happens

Trigger: Query planning for bucketed execution when nodeSelectionStrategy holds an unrecognized value — e.g. a strategy configured in the connector/catalog properties or set by a scheduler extension that this hive plugin version doesn't implement.

Common situations: Setting an unsupported node-selection strategy in catalog config; planner extension supplying a strategy not implemented by the Hive connector; version skew where a newer strategy name is used against an older plugin.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/e558e6fb86f16315. Report an issue: GitHub.