{"record":{"id":"87669169d88fe3a5","repo":"prestodb/presto","slug":"s-codec-is-not-supported","errorCode":null,"errorMessage":"%s codec is not supported","messagePattern":"(.+?) codec is not supported","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"presto-parquet/src/main/java/com/facebook/presto/parquet/writer/ParquetCompressor.java","lineNumber":50,"sourceCode":"{\n    ParquetDataOutput compress(BytesInput bytesInput)\n            throws IOException;\n\n    static ParquetCompressor getCompressor(CompressionCodecName codec)\n    {\n        // TODO Support LZO and LZ4 compression\n        // When using airlift LZO or LZ4 compressor, decompressing page in reader throws exception.\n        switch (codec.getParquetCompressionCodec()) {\n            case GZIP:\n                return new GzipCompressor();\n            case SNAPPY:\n                return new AirLiftCompressor(new SnappyCompressor());\n            case ZSTD:\n                return new AirLiftCompressor(new ZstdCompressor());\n            case UNCOMPRESSED:\n                return null;\n        }\n        throw new RuntimeException(String.format(\"%s codec is not supported\", codec));\n    }\n\n    class GzipCompressor\n            implements ParquetCompressor\n    {\n        @Override\n        public ParquetDataOutput compress(BytesInput bytesInput)\n                throws IOException\n        {\n            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n            try (GZIPOutputStream outputStream = new GZIPOutputStream(byteArrayOutputStream)) {\n                outputStream.write(bytesInput.toByteArray(), 0, toIntExact(bytesInput.size()));\n            }\n            byte[] bytes = byteArrayOutputStream.toByteArray();\n            return createDataOutput(Slices.wrappedBuffer(bytes, 0, bytes.length));\n        }\n    }\n","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-parquet/src/main/java/com/facebook/presto/parquet/writer/ParquetCompressor.java#L32-L68","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ncompressionCodec = CompressionCodecName.LZ4; // not implemented\n// after\ncompressionCodec = CompressionCodecName.ZSTD; // supported by ParquetCompressor.getCompressor","handlingStrategy":"validation","validationCode":"// Java\nimport org.apache.parquet.hadoop.metadata.CompressionCodecName;\nstatic boolean isSupportedParquetCodec(CompressionCodecName codec) {\n    switch (codec) {\n        case GZIP:\n        case SNAPPY:\n        case ZSTD:\n        case UNCOMPRESSED:\n            return true;\n        default:\n            return false;\n    }\n}","typeGuard":null,"tryCatchPattern":"// Java\ntry {\n    ParquetCompressor c = ParquetCompressor.getCompressor(codec);\n} catch (RuntimeException e) {\n    throw new IllegalArgumentException(\"Unsupported Parquet codec in config: \" + codec, e);\n}","preventionTips":["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"],"tags":["parquet","compression-codec","unsupported-feature","configuration"],"backgroundTag":"unsupported-compression-codec","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}