apache/druid · error · UnsupportedOperationException

NONE compression strategy shouldn't use any decompressor

Error message

NONE compression strategy shouldn't use any decompressor

What it means

CompressionStrategy.NONE means data is stored uncompressed, so requesting a Decompressor from it is by definition invalid; the enum method throws UnsupportedOperationException. Callers must handle NONE before obtaining a decompressor.

Source

Thrown at processing/src/main/java/org/apache/druid/segment/data/CompressionStrategy.java:116

      return UncompressedDecompressor.DEFAULT_DECOMPRESSOR;
    }

    @Override
    public Compressor getCompressor()
    {
      return UncompressedCompressor.DEFAULT_COMPRESSOR;
    }
  },
  /**
   * This value indicate no compression strategy should be used, and compression should not be block based.
   * {@link ColumnarLongs}, {@link ColumnarFloats} and {@link ColumnarDoubles} support non block based compression, and
   * other types treat this as {@link #UNCOMPRESSED}.
   */
  NONE((byte) 0xFE) {
    @Override
    public Decompressor getDecompressor()
    {
      throw new UnsupportedOperationException("NONE compression strategy shouldn't use any decompressor");
    }

    @Override
    public Compressor getCompressor()
    {
      throw new UnsupportedOperationException("NONE compression strategy shouldn't use any compressor");
    }
  };
  private static final Logger LOG = new Logger(CompressionStrategy.class);

  public static final CompressionStrategy DEFAULT_COMPRESSION_STRATEGY = LZ4;

  final byte id;

  CompressionStrategy(byte id)
  {
    this.id = id;
  }

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Branch on the strategy before decompressing: if strategy == CompressionStrategy.NONE, copy bytes without a Decompressor
  2. Use CompressionStrategy.UNCOMPRESSED instead of NONE in generic paths, since it returns a pass-through decompressor
  3. If the segment metadata unexpectedly says NONE, fix the ingestion spec that wrote it

Example fix

// before
Decompressor d = strategy.getDecompressor();
// after
Decompressor d = (strategy == CompressionStrategy.NONE)
    ? CompressionStrategy.UNCOMPRESSED.getDecompressor()
    : strategy.getDecompressor();
Defensive patterns

Strategy: type-guard

Validate before calling

if (strategy == CompressionStrategy.NONE) { skipDecompression(); }

Type guard

if (strategy != CompressionStrategy.NONE) { Decompressor d = strategy.getDecompressor(); ... }

Try / catch

try {
  d = strategy.getDecompressor();
} catch (UnsupportedOperationException e) {
  d = CompressionStrategy.UNCOMPRESSED.getDecompressor();
}

Prevention

When it happens

Trigger: Calling compressionStrategy.getDecompressor() when the strategy is CompressionStrategy.NONE, e.g. after loading a segment whose metadata declares no compression.

Common situations: Generic decompression code paths that fail to special-case uncompressed segments; segments written with compression: "none" in the ingestion spec then read by code assuming compression.

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


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/37701001c16457ef. Report an issue: GitHub.