apache/druid · error · UnsupportedOperationException

Serialization not supported here

Error message

Serialization not supported here

What it means

SpectatorHistogramIndexed is a runtime-only view over already-serialized column data; getSerializedSize() is intentionally unsupported because this Indexed is never re-serialized. Calling it throws UnsupportedOperationException.

Source

Thrown at extensions-contrib/spectator-histogram/src/main/java/org/apache/druid/spectator/histogram/SpectatorHistogramIndexed.java:153

    return strategy.fromByteBuffer(copyValueBuffer, offset.getLength());
  }

  @Override
  public int indexOf(@Nullable SpectatorHistogram value)
  {
    throw new UnsupportedOperationException("Reverse lookup not allowed.");
  }

  @Override
  public Iterator<SpectatorHistogram> iterator()
  {
    return IndexedIterable.create(this).iterator();
  }

  @Override
  public long getSerializedSize()
  {
    throw new UnsupportedOperationException("Serialization not supported here");
  }

  @Override
  public void writeTo(WritableByteChannel channel, SegmentFileBuilder fileBuilder)
  {
    throw new UnsupportedOperationException("Serialization not supported here");
  }

  @Override
  public void inspectRuntimeShape(RuntimeShapeInspector inspector)
  {
    inspector.visit("headerBuffer", offsetsHeader);
    inspector.visit("firstValueBuffer", valueBuffer);
    inspector.visit("strategy", strategy);
  }

  @Override
  public String toString()

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Avoid serializing this Indexed; it is read-only query runtime state.
  2. If persistence is needed, go through SpectatorHistogramSerializer / the column's own serializer instead of Indexed.getSerializedSize().
  3. Check whether the calling framework path should be skipped for this column type.
Defensive patterns

Strategy: type-guard

Validate before calling

if (indexed instanceof SpectatorHistogramIndexed) { throw new UnsupportedOperationException("serialization not supported; use the column serializer"); }

Type guard

boolean isSerializable(Indexed<?> idx) { return !(idx instanceof SpectatorHistogramIndexed); }

Try / catch

try { long size = indexed.getSerializedSize(); ... } catch (UnsupportedOperationException e) { throw new IllegalStateException("cannot persist runtime histogram dictionary"); }

Prevention

When it happens

Trigger: Calling getSerializedSize() on the histogram column's Indexed, e.g. generic code that writes Indexed data back out (merge paths, spill-to-disk code, segment merge machinery touching dictionary serialization).

Common situations: Running merge or persist operations over query results containing spectator-histogram dictionary values; framework code that unconditionally measures serialized size before writing.

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