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
- Set the writer compression to a supported kind (NONE, ZLIB, SNAPPY, LZ4, ZSTD)
- Upgrade presto-orc so the chosen compression kind is mapped
- 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
- Validate session/config compression values against the writer's supported set at startup
- Avoid custom compression kinds unless the fork maps them to protobuf
- Document supported codecs next to writer config
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
- compression not implemented yet
- NOT_SUPPORTED
- Unsupported compression for verification:
- Write-side compression verification failed: %s (uncompressed
- Write-side compression verification failed: chunk does not d
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/523e79e9cba9b7fc.
Report an issue: GitHub.