{"record":{"id":"91d77586ebd99df9","repo":"prestodb/presto","slug":"hive-invalid-partition-value-91d775","errorCode":"HIVE_INVALID_PARTITION_VALUE","errorMessage":"Invalid partition value '%s' for BOOLEAN partition key: %s","messagePattern":"Invalid partition value '(.+?)' for BOOLEAN partition key: (.+?)","errorType":"validation","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/HiveUtil.java","lineNumber":827,"sourceCode":"    {\n        String baseName = type.getTypeSignature().getBase();\n        return baseName.equals(StandardTypes.MAP) || baseName.equals(StandardTypes.ARRAY) || baseName.equals(StandardTypes.ROW);\n    }\n\n    public static boolean isStructuralType(HiveType hiveType)\n    {\n        return hiveType.getCategory() == Category.LIST || hiveType.getCategory() == Category.MAP || hiveType.getCategory() == Category.STRUCT;\n    }\n\n    public static boolean booleanPartitionKey(String value, String name)\n    {\n        if (value.equalsIgnoreCase(\"true\")) {\n            return true;\n        }\n        if (value.equalsIgnoreCase(\"false\")) {\n            return false;\n        }\n        throw new PrestoException(HIVE_INVALID_PARTITION_VALUE, format(\"Invalid partition value '%s' for BOOLEAN partition key: %s\", value, name));\n    }\n\n    public static long bigintPartitionKey(String value, String name)\n    {\n        try {\n            return parseLong(value);\n        }\n        catch (NumberFormatException e) {\n            throw new PrestoException(HIVE_INVALID_PARTITION_VALUE, format(\"Invalid partition value '%s' for BIGINT partition key: %s\", value, name));\n        }\n    }\n\n    public static long integerPartitionKey(String value, String name)\n    {\n        try {\n            return parseInt(value);\n        }\n        catch (NumberFormatException e) {","sourceCodeStart":809,"sourceCodeEnd":845,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/HiveUtil.java#L809-L845","documentation":"This error is thrown by HiveUtil.booleanPartitionKey when a partition value string for a BOOLEAN partition column cannot be interpreted as true or false. The Hive connector parses string partition values in the metastore into their typed representations; if the string is not (case-insensitively) 'true' or 'false', the connector cannot build the partition and throws HIVE_INVALID_PARTITION_VALUE. It indicates the partition value stored in or supplied to the metastore does not match the declared column type.","triggerScenarios":"Calling parsePartitionValue or typedPartitionKey for a BOOLEAN partition key whose string value is anything other than 'true'/'false' (ignoring case), e.g. '1', '0', 'yes', '', 'TRUE ' with trailing whitespace.","commonSituations":"Writing partitions with tools that serialize booleans as 1/0 (common in Spark/Python writers), empty partition directories like key=__HIVE_DEFAULT_PARTITION__ or blank values, or a table whose partition column type was changed to BOOLEAN after partitions were created with raw strings.","solutions":["Correct the partition value string to 'true' or 'false' (case-insensitive) at the source that writes the partition (writer job, ALTER TABLE ADD PARTITION, or metastore data).","If partitions already exist with bad values, repair them: drop and re-add the partition with a valid value, or use MSCK/ALTER TABLE to fix the metastore entries.","Verify the partition column type matches the data actually written; if values are genuinely 1/0, consider a BIGINT/INTEGER partition key instead of BOOLEAN.","Filter out or map special sentinel values (e.g. __HIVE_DEFAULT_PARTITION__, empty strings) before parsing."],"exampleFix":"// before (writer)\nString value = boolVal ? \"1\" : \"0\";\n// after\nString value = boolVal ? \"true\" : \"false\";","handlingStrategy":"validation","validationCode":"boolean isValidBooleanPartitionValue(String v) { return \"true\".equalsIgnoreCase(v) || \"false\".equalsIgnoreCase(v); }","typeGuard":null,"tryCatchPattern":"try { ... } catch (PrestoException e) { if (HiveErrorCode.HIVE_INVALID_PARTITION_VALUE.toErrorCode().getCode() == e.getErrorCode().getCode()) { /* repair partition value or skip partition */ } else throw e; }","preventionTips":["Write boolean partitions strictly as 'true'/'false', never 1/0 or yes/no","Trim strings before writing partition values","Validate partition values in the writer pipeline before ADD PARTITION","Watch for __HIVE_DEFAULT_PARTITION__ sentinel directories when scanning partitions"],"tags":["hive","partitioning","type-parsing"],"backgroundTag":"invalid-hive-partition-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"}