prestodb/presto · error · RuntimeException
%s codec is not supported
Error message
%s codec is not supported
What it means
ParquetCompressor.getCompressor maps a Parquet CompressionCodecName to a ParquetCompressor implementation. Only GZIP, SNAPPY, ZSTD, and UNCOMPRESSED are wired up (LZO and LZ4 are explicitly unsupported TODOs). This RuntimeException is the fall-through guard thrown when the requested codec is anything else — i.e. you asked the writer to use a compression codec Presto's Parquet writer does not implement.
Source
Thrown at presto-parquet/src/main/java/com/facebook/presto/parquet/writer/ParquetCompressor.java:50
{
ParquetDataOutput compress(BytesInput bytesInput)
throws IOException;
static ParquetCompressor getCompressor(CompressionCodecName codec)
{
// TODO Support LZO and LZ4 compression
// When using airlift LZO or LZ4 compressor, decompressing page in reader throws exception.
switch (codec.getParquetCompressionCodec()) {
case GZIP:
return new GzipCompressor();
case SNAPPY:
return new AirLiftCompressor(new SnappyCompressor());
case ZSTD:
return new AirLiftCompressor(new ZstdCompressor());
case UNCOMPRESSED:
return null;
}
throw new RuntimeException(String.format("%s codec is not supported", codec));
}
class GzipCompressor
implements ParquetCompressor
{
@Override
public ParquetDataOutput compress(BytesInput bytesInput)
throws IOException
{
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try (GZIPOutputStream outputStream = new GZIPOutputStream(byteArrayOutputStream)) {
outputStream.write(bytesInput.toByteArray(), 0, toIntExact(bytesInput.size()));
}
byte[] bytes = byteArrayOutputStream.toByteArray();
return createDataOutput(Slices.wrappedBuffer(bytes, 0, bytes.length));
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Switch the compression codec to a supported one: GZIP, SNAPPY, ZSTD, or UNCOMPRESSED (SNAPPY or ZSTD recommended)
- Check the Presto config property controlling Parquet compression and correct the value
- If LZ4/LZO is required, upgrade Presto or implement the codec in ParquetCompressor (see the TODO)
- Wrap writer construction to fail fast with a clear config message instead of hitting the runtime fall-through
Example fix
// before compressionCodec = CompressionCodecName.LZ4; // not implemented // after compressionCodec = CompressionCodecName.ZSTD; // supported by ParquetCompressor.getCompressor
Defensive patterns
Strategy: validation
Validate before calling
// Java
import org.apache.parquet.hadoop.metadata.CompressionCodecName;
static boolean isSupportedParquetCodec(CompressionCodecName codec) {
switch (codec) {
case GZIP:
case SNAPPY:
case ZSTD:
case UNCOMPRESSED:
return true;
default:
return false;
}
} Try / catch
// Java
try {
ParquetCompressor c = ParquetCompressor.getCompressor(codec);
} catch (RuntimeException e) {
throw new IllegalArgumentException("Unsupported Parquet codec in config: " + codec, e);
} Prevention
- Restrict writer configuration to GZIP, SNAPPY, ZSTD, or UNCOMPRESSED
- Validate the compression-codec config value at startup, before writing any data
- Do not reuse ORC-specific codec settings (LZ4/LZO/BROTLI) for Parquet output
- Fail fast with a clear config error instead of letting the switch fall through
When it happens
Trigger: Constructing a Parquet writer/compression setup with codec LZO, LZ4, BROTLI, or any other CompressionCodecName not in {GZIP, SNAPPY, ZSTD, UNCOMPRESSED}, causing getCompressor to fall through the switch.
Common situations: Configuring `hive.compression-codec` or writer properties to LZ4/BROTLI/LZO for Parquet output; copying a config from an ORC or other-format job where those codecs are valid; version drift where a codec enum value exists but the writer never implemented it.
Related errors
- DISTRIBUTED_TRACING_ERROR
- Applying decryptor on plaintext file
- Column encrypted with footer key: No keys available
- ACCUMULO_TABLE_EXISTS
- UNEXPECTED_ACCUMULO_ERROR
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/87669169d88fe3a5.
Report an issue: GitHub.