prestodb/presto · error · IllegalArgumentException

Unsupported compression for verification:

Error message

Unsupported compression for verification: 

What it means

createVerifyDecompressor builds a matching decompressor used to round-trip verify freshly compressed chunks on the write path. If the current CompressionKind is none of NONE, SNAPPY, ZLIB, LZ4, or ZSTD, the kind is unknown to this writer and IllegalArgumentException is thrown. This guards against enum values this library version cannot verify.

Source

Thrown at presto-orc/src/main/java/com/facebook/presto/orc/OrcOutputBuffer.java:600

    {
        compressedOutputStream.ensureAvailable(3, length + 3);
        compressedOutputStream.writeHeader(header);
        compressedOutputStream.writeBytes(chunk, offset, length);
    }

    private static Decompressor createVerifyDecompressor(CompressionKind compressionKind)
    {
        switch (compressionKind) {
            case SNAPPY:
                return new SnappyDecompressor();
            case ZLIB:
                return new InflateDecompressor();
            case LZ4:
                return new Lz4Decompressor();
            case ZSTD:
                return new ZstdJniDecompressor();
            default:
                throw new IllegalArgumentException("Unsupported compression for verification: " + compressionKind);
        }
    }

    /**
     * Decompresses a freshly compressed chunk and checks it round-trips to the original bytes.
     * Throws {@link OrcCompressionVerificationException} on decode failure or content mismatch so
     * the write is aborted before a corrupt chunk is persisted. The scratch buffer is borrowed
     * from a dedicated 'decompressionBufferPool', kept separate from the compression buffer pool
     * so the compressed chunk being verified and its decoded copy never alias.
     */
    @VisibleForTesting
    static void verifyCompressedChunk(
            Decompressor verifyDecompressor,
            CompressionBufferPool decompressionBufferPool,
            byte[] original,
            int offset,
            int length,
            byte[] compressed,

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Upgrade presto-orc to a version whose createVerifyDecompressor supports the configured compression kind
  2. Switch the writer's compression kind to a supported one (ZLIB, ZSTD, LZ4, SNAPPY, or NONE)
  3. Validate/whitelist the compression kind before constructing OrcWriter

Example fix

// before
.setCompressionKind(compressionKindFromConfig)
// after
if (compressionKind != CompressionKind.ZLIB && compressionKind != CompressionKind.ZSTD && compressionKind != CompressionKind.LZ4) {
    compressionKind = CompressionKind.ZSTD; // safe default
}
.setCompressionKind(compressionKind)
Defensive patterns

Strategy: validation

Validate before calling

switch (kind) {
    case NONE: case SNAPPY: case ZLIB: case LZ4: case ZSTD: return;
    default: throw new IllegalArgumentException("Unsupported compression: " + kind);
}
OrcWriter.builder(...).setCompressionKind(kind)...

Type guard

boolean isVerifiableCompression(CompressionKind k) {
    return k == NONE || k == SNAPPY || k == ZLIB || k == LZ4 || k == ZSTD;
}

Try / catch

try { OrcWriter w = builder.setCompressionKind(kind).build(); }
catch (IllegalArgumentException e) { /* fall back to ZSTD */ }

Prevention

When it happens

Trigger: ORC writer configured with a CompressionKind not supported for verification (e.g. an enum value added by a newer library or unrecognized value), reaching the default branch during writeChunkToOutputStream verification.

Common situations: Running an older presto-orc version against files/config written for a newer compression codec; programmatic construction of CompressionKind from an unvalidated integer codec id.

Related errors


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