prestodb/presto · error · IllegalArgumentException

Unsupported compression kind:

Error message

Unsupported compression kind: 

What it means

OrcMetadataWriter.toCompression() maps internal CompressionKind values to ORC protobuf CompressionKind when building the postscript (called from postScriptProtobuf). An unmapped compression kind throws IllegalArgumentException("Unsupported compression kind: ..."). Mirror image of the reader-side equivalent, guarding writes instead of reads.

Source

Thrown at presto-orc/src/main/java/com/facebook/presto/orc/metadata/OrcMetadataWriter.java:407

        }
        return builder.setStatistics(toColumnStatistics(rowGroupIndex.getColumnStatistics())).build();
    }

    private static OrcProto.CompressionKind toCompression(CompressionKind compressionKind)
    {
        switch (compressionKind) {
            case NONE:
                return OrcProto.CompressionKind.NONE;
            case ZLIB:
                return OrcProto.CompressionKind.ZLIB;
            case SNAPPY:
                return OrcProto.CompressionKind.SNAPPY;
            case LZ4:
                return OrcProto.CompressionKind.LZ4;
            case ZSTD:
                return OrcProto.CompressionKind.ZSTD;
        }
        throw new IllegalArgumentException("Unsupported compression kind: " + compressionKind);
    }

    private static int writeProtobufObject(OutputStream output, MessageLite object)
            throws IOException
    {
        CountingOutputStream countingOutput = new CountingOutputStream(output);
        object.writeTo(countingOutput);
        return toIntExact(countingOutput.getCount());
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Set the writer compression to a supported kind (NONE, ZLIB, SNAPPY, LZ4, ZSTD)
  2. Upgrade presto-orc so the chosen compression kind is mapped
  3. Validate the compression config value before creating the writer

Example fix

// before
OrcWriterOptions options = new OrcWriterOptionsBuilder().withCompression(NEW_CODEC).build(); // throws at write time
// after
checkArgument(EnumSet.of(NONE, ZLIB, SNAPPY, LZ4, ZSTD).contains(compressionKind), "Unsupported compression: %s", compressionKind);
Defensive patterns

Strategy: validation

Validate before calling

EnumSet<CompressionKind> writable = EnumSet.of(NONE, ZLIB, SNAPPY, LZ4, ZSTD);
checkArgument(writable.contains(sessionCompression), "Compression %s not supported by ORC writer", sessionCompression);

Try / catch

try {
    orcWriter = new OrcWriter(..., compressionKind, ...);
} catch (IllegalArgumentException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Unsupported compression kind:")) {
        // fall back to ZLIB
        orcWriter = new OrcWriter(..., ZLIB, ...);
    } else { throw e; }
}

Prevention

When it happens

Trigger: Configuring an ORC writer with a CompressionKind not handled in toCompression()'s switch, hit when the postscript is serialized.

Common situations: Session/config choosing a codec unsupported by the writer's protobuf mapping; forks adding codecs; version skew between config surface and writer code.

Related errors


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