{"record":{"id":"89bfeff772d182e1","repo":"prestodb/presto","slug":"node-selection-not-supported-89bfef","errorCode":"NODE_SELECTION_NOT_SUPPORTED","errorMessage":"Unsupported node selection strategy %s","messagePattern":"Unsupported node selection strategy (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/sql/planner/NodePartitioningManager.java","lineNumber":171,"sourceCode":"        NodeSelectionStrategy nodeSelectionStrategy = connectorBucketNodeMap.getNodeSelectionStrategy();\n        boolean cacheable;\n        switch (nodeSelectionStrategy) {\n            case HARD_AFFINITY:\n                bucketToNode = getFixedMapping(connectorBucketNodeMap);\n                cacheable = false;\n                break;\n            case SOFT_AFFINITY:\n                bucketToNode = getFixedMapping(connectorBucketNodeMap);\n                cacheable = true;\n                break;\n            case NO_PREFERENCE:\n                bucketToNode = createArbitraryBucketToNode(\n                        nodeScheduler.createNodeSelector(session, connectorId).selectRandomNodes(getMaxTasksPerStage(session)),\n                        connectorBucketNodeMap.getBucketCount());\n                cacheable = false;\n                break;\n            default:\n                throw new PrestoException(NODE_SELECTION_NOT_SUPPORTED, format(\"Unsupported node selection strategy %s\", nodeSelectionStrategy));\n        }\n\n        int[] bucketToPartition = new int[connectorBucketNodeMap.getBucketCount()];\n        BiMap<InternalNode, Integer> nodeToPartition = HashBiMap.create();\n        int nextPartitionId = 0;\n        for (int bucket = 0; bucket < bucketToNode.size(); bucket++) {\n            InternalNode node = bucketToNode.get(bucket);\n            Integer partitionId = nodeToPartition.get(node);\n            if (partitionId == null) {\n                partitionId = nextPartitionId++;\n                nodeToPartition.put(node, partitionId);\n            }\n            bucketToPartition[bucket] = partitionId;\n        }\n\n        List<InternalNode> partitionToNode = IntStream.range(0, nodeToPartition.size())\n                .mapToObj(partitionId -> nodeToPartition.inverse().get(partitionId))\n                .collect(toImmutableList());","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/sql/planner/NodePartitioningManager.java#L153-L189","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before (custom connector)\nreturn NodeSelectionStrategy.UNKNOWN;\n// after\nreturn NodeSelectionStrategy.HARD_AFFINITY;","handlingStrategy":"validation","validationCode":"// Before issuing queries through the catalog, check the connector's node selection strategy\nString strategy = connectorMetadata.getNodeSelectionStrategy().name();\nSet<String> supported = Set.of(\"HARD_AFFINITY\", \"SOFT_AFFINITY\", \"ARBITRARY\");\nif (!supported.contains(strategy)) {\n    throw new IllegalStateException(\"Unsupported node selection strategy: \" + strategy);\n}","typeGuard":"boolean isSupportedStrategy(NodeSelectionStrategy s) {\n    return s == NodeSelectionStrategy.HARD_AFFINITY\n        || s == NodeSelectionStrategy.SOFT_AFFINITY\n        || s == NodeSelectionStrategy.ARBITRARY;\n}","tryCatchPattern":"try {\n    runQuery(sql);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getName().equals(\"NODE_SELECTION_NOT_SUPPORTED\")) {\n        throw new IllegalStateException(\"Connector uses an unsupported node selection strategy: \" + e.getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["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"],"tags":["presto","planner","connector","node-selection","not-supported"],"backgroundTag":"unsupported-node-selection-strategy","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}