{"record":{"id":"c26700de615a0d0f","repo":"prestodb/presto","slug":"hive-invalid-metadata-c26700","errorCode":"HIVE_INVALID_METADATA","errorMessage":"Invalid value for %s property: %s","messagePattern":"Invalid value for (.+?) property: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/HiveUtil.java","lineNumber":1087,"sourceCode":"    }\n\n    public static int getHeaderCount(Properties schema)\n    {\n        return getPositiveIntegerValue(schema, \"skip.header.line.count\", \"0\");\n    }\n\n    public static int getFooterCount(Properties schema)\n    {\n        return getPositiveIntegerValue(schema, \"skip.footer.line.count\", \"0\");\n    }\n\n    private static int getPositiveIntegerValue(Properties schema, String key, String defaultValue)\n    {\n        String value = schema.getProperty(key, defaultValue);\n        try {\n            int intValue = Integer.parseInt(value);\n            if (intValue < 0) {\n                throw new PrestoException(HIVE_INVALID_METADATA, format(\"Invalid value for %s property: %s\", key, value));\n            }\n            return intValue;\n        }\n        catch (NumberFormatException e) {\n            throw new PrestoException(HIVE_INVALID_METADATA, format(\"Invalid value for %s property: %s\", key, value));\n        }\n    }\n\n    public static Object typedPartitionKey(ConnectorSession session, String value, Type type, String name, DateTimeZone hiveStorageTimeZone)\n    {\n        byte[] bytes = value.getBytes(UTF_8);\n\n        if (isHiveNull(bytes)) {\n            return null;\n        }\n        else if (type.equals(BOOLEAN)) {\n            return booleanPartitionKey(value, name);\n        }","sourceCodeStart":1069,"sourceCodeEnd":1105,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/HiveUtil.java#L1069-L1105","documentation":"Thrown by getPositiveIntegerValue when a table property (e.g. orc_bloom_filter_fpp, buckets-related integers) parsed from the Hive schema Properties is negative. Presto requires these stored properties to be positive integers.","triggerScenarios":"Reading table metadata where a known integer property stored in the metastore's Properties is a negative integer (parses fine but intValue < 0).","commonSituations":"Corrupt/manually edited table properties in the metastore; external tools writing negative values; schema-injected properties with invalid defaults.","solutions":["Fix the table property in the metastore: ALTER TABLE ... SET TBLPROPERTIES ('key'='positive_value')","Inspect the table's SERDEPROPERTIES/TBLPROPERTIES and remove the negative key","Recreate the table with correct properties if the metastore entry is corrupt"],"exampleFix":"-- before\nALTER TABLE db.t SET TBLPROPERTIES ('orc_bloom_filter_fpp'='-0.5');\n-- after\nALTER TABLE db.t SET TBLPROPERTIES ('orc_bloom_filter_fpp'='0.05');","handlingStrategy":"validation","validationCode":"Properties schema = /* metastore table properties */;\nString v = schema.getProperty(\"orc_bloom_filter_fpp\", \"0.05\");\nif (Integer.parseInt(v) < 0) throw new IllegalStateException(\"fix table property: negative value \" + v);","typeGuard":"boolean hasPositiveIntProperty(java.util.Properties schema, String key) {\n    try { return Integer.parseInt(schema.getProperty(key, \"0\")) >= 0; }\n    catch (NumberFormatException e) { return false; }\n}","tryCatchPattern":"try { conn.createStatement().executeQuery(\"SELECT ... FROM db.t\"); }\ncatch (com.facebook.presto.spi.PrestoException e) {\n    if (\"HIVE_INVALID_METADATA\".equals(e.getErrorCode().getName())) { /* ALTER TABLE SET TBLPROPERTIES */ }\n    else throw e;\n}","preventionTips":["Audit TBLPROPERTIES after external ETL modifies tables","Never hand-edit metastore properties without validation","Validate numeric properties in ingestion pipelines before ALTER TABLE"],"tags":["hive","table-properties","metadata"],"backgroundTag":"invalid-table-property","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"}