{"record":{"id":"05d3ef99cc4c5911","repo":"prestodb/presto","slug":"unsupported-bucket-function-type-05d3ef","errorCode":null,"errorMessage":"Unsupported bucket function type ","messagePattern":"Unsupported bucket function type ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/HiveNodePartitioningProvider.java","lineNumber":64,"sourceCode":"        implements ConnectorNodePartitioningProvider\n{\n    @Override\n    public BucketFunction getBucketFunction(\n            ConnectorTransactionHandle transactionHandle,\n            ConnectorSession session,\n            ConnectorPartitioningHandle partitioningHandle,\n            List<Type> partitionChannelTypes,\n            int bucketCount)\n    {\n        HivePartitioningHandle handle = (HivePartitioningHandle) partitioningHandle;\n        BucketFunctionType bucketFunctionType = handle.getBucketFunctionType();\n        switch (bucketFunctionType) {\n            case HIVE_COMPATIBLE:\n                return createHiveCompatibleBucketFunction(bucketCount, handle.getHiveTypes().get(), isLegacyTimestampBucketing(session));\n            case PRESTO_NATIVE:\n                return createPrestoNativeBucketFunction(bucketCount, handle.getTypes().get(), isLegacyTimestampBucketing(session));\n            default:\n                throw new IllegalArgumentException(\"Unsupported bucket function type \" + bucketFunctionType);\n        }\n    }\n\n    @Override\n    public ConnectorBucketNodeMap getBucketNodeMap(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle, List<Node> sortedNodes)\n    {\n        HivePartitioningHandle handle = (HivePartitioningHandle) partitioningHandle;\n        NodeSelectionStrategy nodeSelectionStrategy = getNodeSelectionStrategy(session);\n        int bucketCount = handle.getBucketCount();\n        switch (nodeSelectionStrategy) {\n            case HARD_AFFINITY:\n            case SOFT_AFFINITY:\n                return createBucketNodeMap(Stream.generate(() -> sortedNodes).flatMap(List::stream).limit(bucketCount).collect(toImmutableList()), nodeSelectionStrategy);\n            case NO_PREFERENCE:\n                return createBucketNodeMap(bucketCount);\n            default:\n                throw new PrestoException(NODE_SELECTION_NOT_SUPPORTED, format(\"Unsupported node selection strategy %s\", nodeSelectionStrategy));\n        }","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/HiveNodePartitioningProvider.java#L46-L82","documentation":"HiveNodePartitioningProvider.getBucketFunction maps a bucketing handle's BucketFunctionType (HIVE_COMPATIBLE or PRESTO_NATIVE) to a bucket function. An unrecognized type reaches the default branch and throws IllegalArgumentException, which normally indicates an internal bug or cross-version incompatibility.","triggerScenarios":"A partitioning/bucketing handle carries a BucketFunctionType value unknown to this Presto build — typically from a connector/plugin built for a different version — during bucketed split or node assignment planning.","commonSituations":"Mixing Presto versions in a cluster (coordinator vs worker plugin jars); custom connectors emitting new enum values; stale hive plugin jars on some nodes.","solutions":["Ensure all nodes run the same Presto version with matching hive plugin jars; restart the cluster after an upgrade.","Clear stale plugin directories and redeploy the hive connector.","If reproducible on a single version, file a bug — the type should never reach the default branch through public APIs."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (bucketFunctionType != BucketFunctionType.HIVE_COMPATIBLE && bucketFunctionType != BucketFunctionType.PRESTO_NATIVE) {\n    throw new IllegalStateException(\"Unsupported bucket function type: \" + bucketFunctionType);\n}","typeGuard":"boolean isSupportedBucketFunctionType(Object t) { return t == BucketFunctionType.HIVE_COMPATIBLE || t == BucketFunctionType.PRESTO_NATIVE; }","tryCatchPattern":"try { plan(...); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Unsupported bucket function type\")) { /* align Presto/plugin versions across the cluster */ } else throw e; }","preventionTips":["Keep coordinator, workers, and plugin jars on identical Presto versions.","Redeploy the full hive plugin after upgrades; purge stale jars.","Treat this exception as a deployment/bug signal, not a user input problem."],"tags":["hive","bucketing","illegal-argument","version-compatibility"],"backgroundTag":"unsupported-enum-value","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"}