{"record":{"id":"2b6ae7b45966066a","repo":"prestodb/presto","slug":"hive-unknown-error-2b6ae7","errorCode":"HIVE_UNKNOWN_ERROR","errorMessage":"Partition %s does not have a value for partition column %s","messagePattern":"Partition (.+?) does not have a value for partition column (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive-common/src/main/java/com/facebook/presto/hive/MetadataUtils.java","lineNumber":149,"sourceCode":"        }\n\n        return withColumnDomains(\n                partitionColumns.stream()\n                        .collect(toMap(identity(), column -> buildColumnDomain(column, partitions))));\n    }\n\n    private static Domain buildColumnDomain(ColumnHandle column, List<HivePartition> partitions)\n    {\n        checkArgument(!partitions.isEmpty(), \"partitions cannot be empty\");\n\n        boolean hasNull = false;\n        Set<Object> nonNullValues = new HashSet<>();\n        Type type = null;\n\n        for (HivePartition partition : partitions) {\n            NullableValue value = partition.getKeys().get(column);\n            if (value == null) {\n                throw new PrestoException(HIVE_UNKNOWN_ERROR,\n                        format(\"Partition %s does not have a value for partition column %s\", partition, column));\n            }\n\n            if (value.isNull()) {\n                hasNull = true;\n            }\n            else {\n                nonNullValues.add(value.getValue());\n            }\n\n            if (type == null) {\n                type = value.getType();\n            }\n        }\n\n        if (!nonNullValues.isEmpty()) {\n            Domain domain = Domain.multipleValues(type, ImmutableList.copyOf(nonNullValues));\n            if (hasNull) {","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive-common/src/main/java/com/facebook/presto/hive/MetadataUtils.java#L131-L167","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Refresh/invalidate partition metadata (retry the query; clear affected caches) and re-list partitions.","Verify the partition column names in the table schema match those stored in the metastore (rename mismatch).","Check any custom connector/security plugin that constructs HivePartition objects for dropped keys.","If reproducible on stock Presto, file a bug with the query and table/partition DDL — this is an internal invariant violation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"for (HivePartition p : partitions) {\n    if (!p.getKeys().containsKey(column)) {\n        throw new IllegalStateException(\"partition \" + p + \" missing key \" + column);\n    }\n}","typeGuard":"boolean hasPartitionKey(HivePartition p, ColumnHandle col) {\n    return p != null && p.getKeys() != null && p.getKeys().containsKey(col);\n}","tryCatchPattern":"try {\n    domain = MetadataUtils.buildColumnDomain(column, partitions, types);\n} catch (PrestoException e) {\n    if (e.getErrorCode() == HIVE_UNKNOWN_ERROR.toErrorCode()) {\n        // drop pushdown for this column; fall back to full scan filter\n    }\n}","preventionTips":["Keep table schema and metastore partition columns in sync after renames.","Invalidate partition caches after schema changes.","Test custom connectors to ensure every HivePartition carries all partition keys."],"tags":["hive","partitions","metadata","internal-error"],"backgroundTag":"missing-partition-key","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"}