prestodb/presto · error · PrestoException

HIVE_UNSUPPORTED_FORMAT

HIVE_UNSUPPORTED_FORMAT

Error message

InputFormat is not present in StorageFormat

What it means

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.

Source

Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/StorageFormat.java:56

    private StorageFormat(String serDe, String inputFormat, String outputFormat)
    {
        this.serDe = serDe;
        this.inputFormat = inputFormat;
        this.outputFormat = outputFormat;
    }

    public String getSerDe()
    {
        if (serDe == null) {
            throw new PrestoException(HIVE_INVALID_METADATA, "SerDe is not present in StorageFormat");
        }
        return serDe;
    }

    public String getInputFormat()
    {
        if (inputFormat == null) {
            throw new PrestoException(HIVE_UNSUPPORTED_FORMAT, "InputFormat is not present in StorageFormat");
        }
        return inputFormat;
    }

    public String getOutputFormat()
    {
        if (outputFormat == null) {
            throw new PrestoException(HIVE_UNSUPPORTED_FORMAT, "OutputFormat is not present in StorageFormat");
        }
        return outputFormat;
    }

    @JsonProperty("serDe")
    public String getSerDeNullable()
    {
        return serDe;
    }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Set a valid input format: ALTER TABLE ... SET STORED AS <format> or repair the storage descriptor to include an InputFormat class
  2. Re-create the table with an explicit STORED AS PARQUET/ORC/TEXTFILE clause
  3. Re-add the bad partition with a complete storage descriptor (or run MSCK REPAIR TABLE)
  4. Restore the metastore storage descriptor from backup

Example fix

// before (no input format in descriptor)
CREATE EXTERNAL TABLE t (a int) LOCATION '...';
// after
CREATE EXTERNAL TABLE t (a int) STORED AS ORC LOCATION '...';
Defensive patterns

Strategy: validation

Validate before calling

// Validate storage descriptor before reading
StorageDescriptor sd = table.getSd();
if (sd.getInputFormat() == null) {
    throw new IllegalStateException("missing input format: " + table.getTableName());
}

Try / catch

try {
    selectFrom(table);
} catch (PrestoException e) {
    if (e.getErrorCode().getName().equals("HIVE_UNSUPPORTED_FORMAT")) {
        // repair descriptor: SET STORED AS / recreate table
    }
    throw e;
}

Prevention

When it happens

Trigger: 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().

Common situations: 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.

Related errors


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