{"record":{"id":"16e382b4463c272f","repo":"prestodb/presto","slug":"hive-unsupported-format-16e382","errorCode":"HIVE_UNSUPPORTED_FORMAT","errorMessage":"InputFormat is not present in StorageFormat","messagePattern":"InputFormat is not present in StorageFormat","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/StorageFormat.java","lineNumber":56,"sourceCode":"    private StorageFormat(String serDe, String inputFormat, String outputFormat)\n    {\n        this.serDe = serDe;\n        this.inputFormat = inputFormat;\n        this.outputFormat = outputFormat;\n    }\n\n    public String getSerDe()\n    {\n        if (serDe == null) {\n            throw new PrestoException(HIVE_INVALID_METADATA, \"SerDe is not present in StorageFormat\");\n        }\n        return serDe;\n    }\n\n    public String getInputFormat()\n    {\n        if (inputFormat == null) {\n            throw new PrestoException(HIVE_UNSUPPORTED_FORMAT, \"InputFormat is not present in StorageFormat\");\n        }\n        return inputFormat;\n    }\n\n    public String getOutputFormat()\n    {\n        if (outputFormat == null) {\n            throw new PrestoException(HIVE_UNSUPPORTED_FORMAT, \"OutputFormat is not present in StorageFormat\");\n        }\n        return outputFormat;\n    }\n\n    @JsonProperty(\"serDe\")\n    public String getSerDeNullable()\n    {\n        return serDe;\n    }\n","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/StorageFormat.java#L38-L74","documentation":"StorageFormat.getInputFormat() throws HIVE_UNSUPPORTED_FORMAT when the inputFormat field is null, i.e. the metastore storage descriptor does not specify an InputFormat class. Without an InputFormat, Presto cannot construct a record reader for the data, so it rejects the table/partition as unsupported.","triggerScenarios":"Reading a table/partition whose storage descriptor has no inputFormat — e.g. metadata created by another tool, a view-like storage entry, or a partition registered without a full storage descriptor; getInputFormat is called via inputFormat().","commonSituations":"Partitions added to the metastore with incomplete descriptors; tables created by foreign engines; storage descriptors wiped during metastore migrations; user-created tables with only SERDE specified and no STORED AS / INPUTFORMAT.","solutions":["Set a valid input format: ALTER TABLE ... SET STORED AS <format> or repair the storage descriptor to include an InputFormat class","Re-create the table with an explicit STORED AS PARQUET/ORC/TEXTFILE clause","Re-add the bad partition with a complete storage descriptor (or run MSCK REPAIR TABLE)","Restore the metastore storage descriptor from backup"],"exampleFix":"// before (no input format in descriptor)\nCREATE EXTERNAL TABLE t (a int) LOCATION '...';\n// after\nCREATE EXTERNAL TABLE t (a int) STORED AS ORC LOCATION '...';","handlingStrategy":"validation","validationCode":"// Validate storage descriptor before reading\nStorageDescriptor sd = table.getSd();\nif (sd.getInputFormat() == null) {\n    throw new IllegalStateException(\"missing input format: \" + table.getTableName());\n}","typeGuard":null,"tryCatchPattern":"try {\n    selectFrom(table);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getName().equals(\"HIVE_UNSUPPORTED_FORMAT\")) {\n        // repair descriptor: SET STORED AS / recreate table\n    }\n    throw e;\n}","preventionTips":["Always declare STORED AS PARQUET/ORC/TEXTFILE at table creation","Avoid partial storage descriptors in external metastore writers","Verify partitions added manually carry full descriptors","Audit storage descriptors with DESCRIBE FORMATTED after migrations"],"tags":["hive","metadata","inputformat","storage-format"],"backgroundTag":"missing-inputformat-in-storage-format","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"}