prestodb/presto · error · PrestoException

HIVE_UNSUPPORTED_FORMAT

HIVE_UNSUPPORTED_FORMAT

Error message

Unknown %s compression type %s

What it means

When writing a Hive table in ORC format, Presto maps the table's compression property name to an org.apache.orc.CompressionKind enum via valueOf. If the configured compression name is not one of the enum's constants (NONE, ZLIB, SNAPPY, LZO, LZ4, ZSTD), the ORC writer factory throws HIVE_UNSUPPORTED_FORMAT. It means the compression setting on the table/session is not a codec the ORC writer recognizes.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/OrcFileWriterFactory.java:387

    public DataSink createDataSink(ConnectorSession session, FileSystem fileSystem, Path path)
            throws IOException
    {
        return dataSinkFactory.createDataSink(session, fileSystem, path);
    }

    private static CompressionKind getCompression(Properties schema, JobConf configuration, OrcEncoding orcEncoding)
    {
        String compressionName = OrcConf.COMPRESS.getString(schema, configuration);
        if (compressionName == null) {
            return CompressionKind.ZLIB;
        }

        CompressionKind compression;
        try {
            compression = CompressionKind.valueOf(compressionName.toUpperCase(ENGLISH));
        }
        catch (IllegalArgumentException e) {
            throw new PrestoException(HIVE_UNSUPPORTED_FORMAT, "Unknown " + orcEncoding + " compression type " + compressionName);
        }
        return compression;
    }

    private Set<Integer> getFlattenedColumns(Properties schema, ConnectorSession session)
    {
        boolean flatMapsEnabled = parseBoolean(schema.getProperty(ORC_FLAT_MAP_WRITER_ENABLED_KEY, "false"));
        ImmutableSet.Builder<Integer> flattenedColumnsBuilder = ImmutableSet.builder();
        if (flatMapsEnabled) {
            String columnsValue = schema.getProperty(ORC_FLAT_MAP_COLUMN_NUMBERS_KEY, "");
            FLAT_MAP_COLUMN_NUMBERS_SPLITTER.splitToList(columnsValue).stream()
                    .map(Integer::valueOf)
                    .forEach(flattenedColumnsBuilder::add);
        }
        Set<Integer> flattenedColumns = flattenedColumnsBuilder.build();

        // fail if flat maps are enabled for the table, but flat map writer is not enabled in the session
        boolean flatMapWriterEnabled = isFlatMapWriterEnabled(session);

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Change the table/session compression to a supported ORC codec: NONE, ZLIB, SNAPPY, LZO, LZ4, or ZSTD (build-dependent).
  2. Check for typos, trailing spaces, or wrong case in the compression property value.
  3. If a newer codec is required, upgrade Presto to a version whose bundled ORC supports it.
  4. If compression came from a session property, correct it with SET SESSION hive.compression_codec = 'ZLIB';

Example fix

// before (table property)
WITH (format='ORC', compression='GZIP')
// after
WITH (format='ORC', compression='ZLIB')
Defensive patterns

Strategy: validation

Validate before calling

import org.apache.orc.CompressionKind;
import java.util.Locale;
boolean isSupportedOrcCompression(String name) {
    if (name == null) return false;
    try { CompressionKind.valueOf(name.trim().toUpperCase(Locale.ROOT)); return true; }
    catch (IllegalArgumentException e) { return false; }
}

Type guard

boolean isValidCompressionKind(String name) {
    return java.util.Arrays.stream(CompressionKind.values())
        .anyMatch(k -> k.name().equalsIgnoreCase(name));
}

Prevention

When it happens

Trigger: Creating or inserting into a Hive table whose compression codec property is set to a string that does not exactly match (case-insensitively) a CompressionKind constant, e.g. 'gzip', 'brotli', or a misspelled/whitespace-padded value.

Common situations: Table definitions copied from other engines that allow codecs ORC does not; typos or trailing spaces in compression config; using a newer codec (e.g. ZSTD) on an older Presto build whose ORC enum lacks it; provisioning tools writing odd compression values into table properties.

Related errors


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