apache/druid · error · UnsupportedOperationException
Directory decompression not supported for %s
Error message
Directory decompression not supported for %s
What it means
The CompressionFormat.decompressDirectory default method throws UnsupportedOperationException because not every format can decompress a whole directory stream; only formats with directory support (gzip/tgz, zip) override it. Calling it on a stream-compression-only format such as LZ4 or ZSTD throws this error. Use the format-specific decompression helpers instead.
Source
Thrown at processing/src/main/java/org/apache/druid/utils/CompressionUtils.java:195
*/
public long compressDirectory(File directory, OutputStream out) throws IOException
{
throw new UnsupportedOperationException("Directory compression not supported for " + this.name());
}
/**
* Decompresses a directory from the input stream. Default implementation throws UnsupportedOperationException.
* Override this method for formats that support directory decompression.
*
* @param in The input stream containing compressed data
* @param outDir The output directory to extract files to
* @return A FileCopyResult containing information about extracted files
* @throws IOException if an I/O error occurs
* @throws UnsupportedOperationException if the format doesn't support directory decompression
*/
public FileUtils.FileCopyResult decompressDirectory(InputStream in, File outDir) throws IOException
{
throw new UnsupportedOperationException("Directory decompression not supported for " + this.name());
}
}
public static final int COMPRESSED_TEXT_WEIGHT_FACTOR = 4;
private static final Logger log = new Logger(CompressionUtils.class);
private static final int DEFAULT_RETRY_COUNT = 3;
private static final int GZIP_BUFFER_SIZE = 8192; // Default is 512
/**
* Zip the contents of directory into the file indicated by outputZipFile. Sub directories are skipped
*
* @param directory The directory whose contents should be added to the zip in the output stream.
* @param outputZipFile The output file to write the zipped data to
* @param fsync True if the output file should be fsynced to disk
*
* @return The number of bytes (uncompressed) read from the input directory.
*
* @throws IOExceptionView on GitHub (pinned to 9b90983fd2)
Solutions
- Use the format-specific decompression path, e.g. CompressionUtils.decompress with a LZ4 InputStream factory, for stream-only formats
- Restrict directory decompression to GZIP/ZIP formats and validate the configured format beforehand
- Catch UnsupportedOperationException and fall back to stream decompression into the target directory
- Check the CompressionFormat implementation for your Druid version to confirm directory support
Example fix
// before
format.decompressDirectory(in, outDir); // throws for LZ4/ZSTD
// after
if (format == CompressionUtils.CompressionFormat.LZ4) {
CompressionUtils.decompress(in, outDir, CompressionUtils.LZ4_STREAM_FACTORY);
} else {
format.decompressDirectory(in, outDir);
} Defensive patterns
Strategy: fallback
Try / catch
try {
format.decompressDirectory(in, outDir);
} catch (UnsupportedOperationException e) {
CompressionUtils.decompress(in, outDir, format-specificFactory);
} Prevention
- Use stream decompression helpers for LZ4/ZSTD
- Validate the configured format supports directory operations before jobs run
- Centralize format dispatch with capability checks
When it happens
Trigger: Calling decompressDirectory on a CompressionFormat like LZ4 or ZSTD, or generically dispatching decompression over formats without checking which override decompressDirectory.
Common situations: Restore/load jobs that decompress whatever format a config names; archives written by a stream compressor being fed to decompressDirectory; version drift where a format lacks the directory override.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Directory compression not supported for %s
- NONE compression strategy shouldn't use any decompressor
- NONE compression strategy shouldn't use any compressor
- Reverse lookup not allowed.
- Serialization not supported here
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/3a73e2495e4b7a59.
Report an issue: GitHub.