prestodb/presto · error · IllegalArgumentException
Unsupported bucket function type
Error message
Unsupported bucket function type
What it means
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.
Source
Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveNodePartitioningProvider.java:64
implements ConnectorNodePartitioningProvider
{
@Override
public BucketFunction getBucketFunction(
ConnectorTransactionHandle transactionHandle,
ConnectorSession session,
ConnectorPartitioningHandle partitioningHandle,
List<Type> partitionChannelTypes,
int bucketCount)
{
HivePartitioningHandle handle = (HivePartitioningHandle) partitioningHandle;
BucketFunctionType bucketFunctionType = handle.getBucketFunctionType();
switch (bucketFunctionType) {
case HIVE_COMPATIBLE:
return createHiveCompatibleBucketFunction(bucketCount, handle.getHiveTypes().get(), isLegacyTimestampBucketing(session));
case PRESTO_NATIVE:
return createPrestoNativeBucketFunction(bucketCount, handle.getTypes().get(), isLegacyTimestampBucketing(session));
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));
}View on GitHub (pinned to 55bb57d202)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
if (bucketFunctionType != BucketFunctionType.HIVE_COMPATIBLE && bucketFunctionType != BucketFunctionType.PRESTO_NATIVE) {
throw new IllegalStateException("Unsupported bucket function type: " + bucketFunctionType);
} Type guard
boolean isSupportedBucketFunctionType(Object t) { return t == BucketFunctionType.HIVE_COMPATIBLE || t == BucketFunctionType.PRESTO_NATIVE; } Try / catch
try { plan(...); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Unsupported bucket function type")) { /* align Presto/plugin versions across the cluster */ } else throw e; } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Mixing Presto versions in a cluster (coordinator vs worker plugin jars); custom connectors emitting new enum values; stale hive plugin jars on some nodes.
Related errors
- unknown java type
- HIVE_INVALID_BUCKET_FILES
- HIVE_INVALID_METADATA
- HIVE_INVALID_METADATA
- Unsupported update mode: %s
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/05d3ef99cc4c5911.
Report an issue: GitHub.