apache/iceberg · error · IllegalArgumentException
Unsupported compression strategy:
Error message
Unsupported compression strategy:
What it means
ORC's write builder converts the compression-strategy config into ORC's CompressionStrategy enum via uppercased valueOf. If the string is not a valid CompressionStrategy name (only SPEED or COMPRESSION), IllegalArgumentException is thrown with this message.
Solutions
- Set the strategy to exactly SPEED or COMPRESSION (any case)
- Remove write.orc.compression-strategy to use the default strategy
- Trim the value and avoid extra characters
Example fix
// before
props.set("write.orc.compression-strategy", "fast");
// after
props.set("write.orc.compression-strategy", "SPEED"); Defensive patterns
Strategy: validation
Validate before calling
String s = props.getProperty("write.orc.compression-strategy", "").toUpperCase(Locale.ROOT).trim();
if (!s.isEmpty() && !s.equals("SPEED") && !s.equals("COMPRESSION")) {
throw new IllegalArgumentException("Invalid ORC compression strategy: " + s);
} Try / catch
try {
builder.set("write.orc.compression-strategy", strategy);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Unsupported compression strategy")) {
log.warn("Invalid strategy '{}', using default", strategy);
builder.build();
} else throw e;
} Prevention
- Only SPEED and COMPRESSION are valid values for ORC compression strategy
- Remove the property entirely to accept the default
- Validate user-supplied table properties against the ORC enum before commit
When it happens
Trigger: Setting the ORC compression strategy property (write.orc.compression-strategy) to anything other than SPEED or COMPRESSION (case-insensitive).
Common situations: Typo such as 'fast' or 'balanced'; copying Parquet/other-format strategy names; accidental whitespace in the property value.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Unsupported compression codec:
- Ignoring invalid metrics mode
- Unknown file content:
- Unsupported compression codec
- Batch reading is not supported in non-vectorized reader
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/1129a6a98acf6388.
Report an issue: GitHub.
Appendix: source
Thrown at orc/src/main/java/org/apache/iceberg/orc/ORC.java:389
compressionKind,
compressionStrategy,
dataContext.bloomFilterColumns(),
dataContext.bloomFilterFpp());
}
private static CompressionKind toCompressionKind(String codecAsString) {
try {
return CompressionKind.valueOf(codecAsString.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Unsupported compression codec: " + codecAsString);
}
}
private static CompressionStrategy toCompressionStrategy(String strategyAsString) {
try {
return CompressionStrategy.valueOf(strategyAsString.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException(
"Unsupported compression strategy: " + strategyAsString);
}
}
}
}
public static DataWriteBuilder writeData(OutputFile file) {
return new DataWriteBuilder(file);
}
public static DataWriteBuilder writeData(EncryptedOutputFile file) {
Preconditions.checkState(
!(file instanceof NativeEncryptionOutputFile), "Native ORC encryption is not supported");
return new DataWriteBuilder(file.encryptingOutputFile());
}
public static class DataWriteBuilder {
private final WriteBuilder appenderBuilder;View on GitHub (pinned to 86d9c8fc54)