prestodb/presto · error · IllegalStateException

compression not implemented yet

Error message

 compression not implemented yet

What it means

OrcMetadataReader.toCompression() converts a protobuf ORC CompressionKind read from a file's postscript into the internal CompressionKind enum. When the enum case has no mapping (e.g. the file uses a compression codec this reader version does not know), it throws IllegalStateException instead of returning a value. It signals the file's compression is not supported by this Presto ORC reader.

Source

Thrown at presto-orc/src/main/java/com/facebook/presto/orc/metadata/OrcMetadataReader.java:621

                throw new IllegalStateException(columnEncodingKind + " stream encoding not implemented yet");
        }
    }

    private static CompressionKind toCompression(OrcProto.CompressionKind compression)
    {
        switch (compression) {
            case NONE:
                return NONE;
            case ZLIB:
                return ZLIB;
            case SNAPPY:
                return SNAPPY;
            case LZ4:
                return LZ4;
            case ZSTD:
                return ZSTD;
            default:
                throw new IllegalStateException(compression + " compression not implemented yet");
        }
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Upgrade presto-orc (and Presto) to a version whose OrcMetadataReader maps the compression kind used by the file
  2. Rewrite/recompress the ORC file with a supported codec (ZLIB, SNAPPY, LZ4, ZSTD)
  3. Inspect the file's postscript compression kind to confirm which codec is unsupported

Example fix

// before
OrcDataSource dataSource = new FileOrcDataSource(file, config);
// after
// verify the file's compression is supported before opening:
CompressionKind kind = readPostscriptCompression(file); // e.g. ZSTD
if (!EnumSet.of(ZLIB, SNAPPY, LZ4, ZSTD).contains(kind)) {
    throw new IllegalArgumentException("Recompress file; unsupported codec: " + kind);
}
Defensive patterns

Strategy: validation

Validate before calling

// Read the postscript compression kind before opening the ORC file and compare against supported set
EnumSet<CompressionKind> supported = EnumSet.of(ZLIB, SNAPPY, LZ4, ZSTD);
if (!supported.contains(fileCompressionKind)) {
    throw new IllegalArgumentException("Recompress ORC file; unsupported codec: " + fileCompressionKind);
}

Try / catch

try {
    orcReader = new OrcReader(dataSource, ...);
} catch (IllegalStateException e) {
    if (e.getMessage() != null && e.getMessage().endsWith("compression not implemented yet")) {
        throw new IOException("ORC file uses an unsupported compression codec; upgrade or recompress", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Reading an ORC file whose postscript declares a compression kind that falls into the default branch of toCompression(), triggered from readPostScript() during file open/metadata read.

Common situations: Opening ORC files written by newer writers using codecs not in the enum mapping; corrupted or hand-crafted postscript; reader/writer version skew where the writer supports a codec the reader doesn't.

Related errors


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