prestodb/presto · error · PrestoException

GENERIC_INTERNAL_ERROR

GENERIC_INTERNAL_ERROR

Error message

SchedulingPolicy is bucketed, but BucketHandle is not present

What it means

Grouped (bucketed) split scheduling was requested, but the table layout carries no HiveBucketHandle, so the scheduler cannot assign splits to bucket-aligned workers. Presto treats this as an invariant violation of the plan and throws GENERIC_INTERNAL_ERROR.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveSplitManager.java:292

        }

        // get partitions
        List<HivePartition> partitions = layout.getPartitions()
                .map(PartitionSet::getFullyLoadedPartitions)
                .orElseThrow(() -> new PrestoException(GENERIC_INTERNAL_ERROR, "Layout does not contain partitions"));

        // short circuit if we don't have any partitions
        HivePartition partition = Iterables.getFirst(partitions, null);
        if (partition == null) {
            return new FixedSplitSource(ImmutableList.of());
        }

        Optional<HiveBucketFilter> bucketFilter = layout.getBucketFilter();

        // validate bucket bucketed execution
        Optional<HiveBucketHandle> bucketHandle = layout.getBucketHandle();
        if ((splitSchedulingContext.getSplitSchedulingStrategy() == GROUPED_SCHEDULING) && !bucketHandle.isPresent()) {
            throw new PrestoException(GENERIC_INTERNAL_ERROR, "SchedulingPolicy is bucketed, but BucketHandle is not present");
        }

        if (bucketHandle.isPresent()) {
            if (bucketHandle.get().getReadBucketCount() > bucketHandle.get().getTableBucketCount()) {
                throw new PrestoException(
                        GENERIC_INTERNAL_ERROR,
                        "readBucketCount (%s) is greater than the tableBucketCount (%s) which generally points to an issue in plan generation");
            }
        }

        // sort partitions
        partitions = Ordering.natural().onResultOf(HivePartition::getPartitionId).reverse().sortedCopy(partitions);

        Iterable<HivePartitionMetadata> hivePartitions = getPartitionMetadata(
                metastore,
                table,
                tableName,
                partitions,

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Disable grouped execution for this query (e.g. SET SESSION hive.bucket_execution = false or adjust node-selection/scheduling policy).
  2. Verify the table is actually bucketed and that bucketing metadata is present in the metastore.
  3. Upgrade/align coordinator and worker versions; if the plan should have produced a bucket handle, file a bug with the query plan.

Example fix

// before
SET SESSION node_selection_strategy = BIN_PACKING_DISTRIBUTED; -- with grouped scheduling forced
// after
SET SESSION hive.bucket_execution = false;
Defensive patterns

Strategy: try-catch

Validate before calling

// before running with grouped scheduling
boolean bucketed = layout.getBucketHandle().isPresent();
if (!bucketed && useGroupedScheduling) { disableGroupedScheduling(); }

Try / catch

catch (PrestoException e) { if (e.getErrorCode().getCode() == GENERIC_INTERNAL_ERROR.toErrorCode().getCode()) { /* rerun with hive.bucket_execution=false */ } else throw e; }

Prevention

When it happens

Trigger: getSplits is invoked with splitSchedulingContext.getSplitSchedulingStrategy() == GROUPED_SCHEDULING while layout.getBucketHandle() is empty — e.g. grouped execution enabled for a table Presto resolved as unbucketed.

Common situations: Session/catalog settings enabling bucketed execution (hive.bucket-execution) applied to an unbucketed or virtually bucketed table where the plan did not produce a bucket handle; planner/connector version mismatch producing inconsistent layout metadata.

Related errors


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