prestodb/presto · error · ParquetCorruptionException

Codec not supported in Parquet:

Error message

Codec not supported in Parquet: 

What it means

ParquetCompressionUtils.decompress dispatches on the Parquet column-chunk codec; codecs outside SNAPPY/GZIP/LZO/LZ4/ZSTD hit the default branch and throw ParquetCorruptionException 'Codec not supported in Parquet'. Either the enum has an unsupported member or the page header was misread.

Solutions

  1. Upgrade Presto to a build supporting the codec (e.g., LZ4_RAW, BROTLI support).
  2. Rewrite/convert the Parquet file with SNAPPY or GZIP compression.
  3. Recompress with a supported codec using parquet-tools/Spark before loading.
  4. Verify file metadata isn't corrupted (re-transfer, validate with parquet-tools meta).

Example fix

// before: file written with BROTLI
spark.write.parquet(...).option("compression", "brotli")
// after
spark.write.parquet(...).option("compression", "snappy")
Defensive patterns

Strategy: validation

Validate before calling

CompressionCodecName codec = footer.getFileMetaData().getCreatedBy() != null ? chunk.getCodec() : null;
EnumSet<CompressionCodecName> ok = EnumSet.of(SNAPPY, GZIP, LZO, LZ4, ZSTD);
if (!ok.contains(chunk.getCodec())) throw new IllegalArgumentException("unsupported codec: " + chunk.getCodec());

Try / catch

try { ParquetCompressionUtils.decompress(codec, input, size); } catch (ParquetCorruptionException e) {
    throw new DataCorruptionException("unsupported parquet codec", e);
}

Prevention

When it happens

Trigger: A Parquet file's column chunk metadata specifies a codec this Presto build cannot decode (e.g., BROTLI or a newer codec like LZ4_RAW on old versions).

Common situations: Files written by tools using BROTLI or LZ4_RAW compression; old Presto version lacking newer codec support; corrupted footer metadata yielding a bogus enum.

Related errors


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

Appendix: source

Thrown at presto-parquet/src/main/java/com/facebook/presto/parquet/ParquetCompressionUtils.java:66

        if (input.length() == 0) {
            return EMPTY_SLICE;
        }

        switch (codec) {
            case GZIP:
                return decompressGzip(input, uncompressedSize);
            case SNAPPY:
                return decompressSnappy(input, uncompressedSize);
            case UNCOMPRESSED:
                return input;
            case LZO:
                return decompressLZO(input, uncompressedSize);
            case LZ4:
                return decompressLz4(input, uncompressedSize);
            case ZSTD:
                return decompressZstd(input, uncompressedSize);
            default:
                throw new ParquetCorruptionException("Codec not supported in Parquet: " + codec);
        }
    }

    private static Slice decompressSnappy(Slice input, int uncompressedSize)
    {
        byte[] buffer = new byte[uncompressedSize];
        decompress(new SnappyDecompressor(), input, 0, input.length(), buffer, 0);
        return wrappedBuffer(buffer);
    }

    private static Slice decompressZstd(Slice input, int uncompressedSize)
    {
        byte[] buffer = new byte[uncompressedSize];
        decompress(new ZstdDecompressor(), input, 0, input.length(), buffer, 0);
        return wrappedBuffer(buffer);
    }

    private static Slice decompressGzip(Slice input, int uncompressedSize)

View on GitHub (pinned to 55bb57d202)