apache/druid · error · UnsupportedOperationException

NONE compression strategy shouldn't use any compressor

Error message

NONE compression strategy shouldn't use any compressor

What it means

The NONE CompressionStrategy stores data uncompressed, so it has no Compressor; getCompressor() throws UnsupportedOperationException. Writers must special-case NONE (or use UNCOMPRESSED, which supplies a no-op compressor) rather than requesting a compressor from it.

Source

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

      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;
  }

  public byte getId()
  {
    return id;
  }

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Use CompressionStrategy.UNCOMPRESSED instead of NONE when a no-op compressor is needed
  2. Check strategy == CompressionStrategy.NONE before calling getCompressor() and skip compression entirely
  3. Change the ingestion spec compression to LZ4/ZSTD if compression is expected

Example fix

// before
Compressor c = strategy.getCompressor();
// after
Compressor c = (strategy == CompressionStrategy.NONE)
    ? CompressionStrategy.UNCOMPRESSED.getCompressor()
    : strategy.getCompressor();
Defensive patterns

Strategy: type-guard

Validate before calling

if (strategy == CompressionStrategy.NONE) { writeUncompressed(); } else { compress(); }

Type guard

if (strategy != CompressionStrategy.NONE) { Compressor c = strategy.getCompressor(); ... }

Try / catch

try {
  c = strategy.getCompressor();
} catch (UnsupportedOperationException e) {
  c = CompressionStrategy.UNCOMPRESSED.getCompressor();
}

Prevention

When it happens

Trigger: Calling getCompressor() on CompressionStrategy.NONE, typically from a segment writer using a generic compression path while the config selects compression strategy NONE.

Common situations: Ingestion specs with compression: "none" flowing through code that unconditionally fetches a compressor; mixing NONE into APIs expecting a real compressor.

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/c3821fac5411e879. Report an issue: GitHub.