{"record":{"id":"523e79e9cba9b7fc","repo":"prestodb/presto","slug":"unsupported-compression-kind","errorCode":null,"errorMessage":"Unsupported compression kind: ","messagePattern":"Unsupported compression kind: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/metadata/OrcMetadataWriter.java","lineNumber":407,"sourceCode":"        }\n        return builder.setStatistics(toColumnStatistics(rowGroupIndex.getColumnStatistics())).build();\n    }\n\n    private static OrcProto.CompressionKind toCompression(CompressionKind compressionKind)\n    {\n        switch (compressionKind) {\n            case NONE:\n                return OrcProto.CompressionKind.NONE;\n            case ZLIB:\n                return OrcProto.CompressionKind.ZLIB;\n            case SNAPPY:\n                return OrcProto.CompressionKind.SNAPPY;\n            case LZ4:\n                return OrcProto.CompressionKind.LZ4;\n            case ZSTD:\n                return OrcProto.CompressionKind.ZSTD;\n        }\n        throw new IllegalArgumentException(\"Unsupported compression kind: \" + compressionKind);\n    }\n\n    private static int writeProtobufObject(OutputStream output, MessageLite object)\n            throws IOException\n    {\n        CountingOutputStream countingOutput = new CountingOutputStream(output);\n        object.writeTo(countingOutput);\n        return toIntExact(countingOutput.getCount());\n    }\n}\n","sourceCodeStart":389,"sourceCodeEnd":418,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/metadata/OrcMetadataWriter.java#L389-L418","documentation":"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.","triggerScenarios":"Configuring an ORC writer with a CompressionKind not handled in toCompression()'s switch, hit when the postscript is serialized.","commonSituations":"Session/config choosing a codec unsupported by the writer's protobuf mapping; forks adding codecs; version skew between config surface and writer code.","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"],"exampleFix":"// before\nOrcWriterOptions options = new OrcWriterOptionsBuilder().withCompression(NEW_CODEC).build(); // throws at write time\n// after\ncheckArgument(EnumSet.of(NONE, ZLIB, SNAPPY, LZ4, ZSTD).contains(compressionKind), \"Unsupported compression: %s\", compressionKind);","handlingStrategy":"validation","validationCode":"EnumSet<CompressionKind> writable = EnumSet.of(NONE, ZLIB, SNAPPY, LZ4, ZSTD);\ncheckArgument(writable.contains(sessionCompression), \"Compression %s not supported by ORC writer\", sessionCompression);","typeGuard":null,"tryCatchPattern":"try {\n    orcWriter = new OrcWriter(..., compressionKind, ...);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Unsupported compression kind:\")) {\n        // fall back to ZLIB\n        orcWriter = new OrcWriter(..., ZLIB, ...);\n    } else { throw e; }\n}","preventionTips":["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"],"tags":["orc","compression","metadata-writer","unsupported-codec"],"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"}