prestodb/presto · error · PrestoException

HIVE_UNKNOWN_ERROR

HIVE_UNKNOWN_ERROR

Error message

Partition %s does not have a value for partition column %s

What it means

MetadataUtils.buildColumnDomain builds a TupleDomain predicate over partition keys for a set of Hive partitions. Each partition must carry a NullableValue for every partition column; if partition.getKeys() lacks the column, the code throws HIVE_UNKNOWN_ERROR because this represents an internal inconsistency (a partition without a full key set), not user error.

Source

Thrown at presto-hive-common/src/main/java/com/facebook/presto/hive/MetadataUtils.java:149

        }

        return withColumnDomains(
                partitionColumns.stream()
                        .collect(toMap(identity(), column -> buildColumnDomain(column, partitions))));
    }

    private static Domain buildColumnDomain(ColumnHandle column, List<HivePartition> partitions)
    {
        checkArgument(!partitions.isEmpty(), "partitions cannot be empty");

        boolean hasNull = false;
        Set<Object> nonNullValues = new HashSet<>();
        Type type = null;

        for (HivePartition partition : partitions) {
            NullableValue value = partition.getKeys().get(column);
            if (value == null) {
                throw new PrestoException(HIVE_UNKNOWN_ERROR,
                        format("Partition %s does not have a value for partition column %s", partition, column));
            }

            if (value.isNull()) {
                hasNull = true;
            }
            else {
                nonNullValues.add(value.getValue());
            }

            if (type == null) {
                type = value.getType();
            }
        }

        if (!nonNullValues.isEmpty()) {
            Domain domain = Domain.multipleValues(type, ImmutableList.copyOf(nonNullValues));
            if (hasNull) {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Refresh/invalidate partition metadata (retry the query; clear affected caches) and re-list partitions.
  2. Verify the partition column names in the table schema match those stored in the metastore (rename mismatch).
  3. Check any custom connector/security plugin that constructs HivePartition objects for dropped keys.
  4. If reproducible on stock Presto, file a bug with the query and table/partition DDL — this is an internal invariant violation.
Defensive patterns

Strategy: try-catch

Validate before calling

for (HivePartition p : partitions) {
    if (!p.getKeys().containsKey(column)) {
        throw new IllegalStateException("partition " + p + " missing key " + column);
    }
}

Type guard

boolean hasPartitionKey(HivePartition p, ColumnHandle col) {
    return p != null && p.getKeys() != null && p.getKeys().containsKey(col);
}

Try / catch

try {
    domain = MetadataUtils.buildColumnDomain(column, partitions, types);
} catch (PrestoException e) {
    if (e.getErrorCode() == HIVE_UNKNOWN_ERROR.toErrorCode()) {
        // drop pushdown for this column; fall back to full scan filter
    }
}

Prevention

When it happens

Trigger: createPredicate iterating partitions where a HivePartition's key map does not contain the requested partition column — typically a corrupted/incomplete partition object produced by metadata listing or a connector bug.

Common situations: Custom Hive connectors or interceptors returning partitions with missing keys; partition metadata partially loaded; bug after schema/partition-column rename where old cached partitions lack the new key.

Related errors


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