{"record":{"id":"0127d09f9f5e9b16","repo":"apache/druid","slug":"serialization-not-supported-here","errorCode":null,"errorMessage":"Serialization not supported here","messagePattern":"Serialization not supported here","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"extensions-contrib/spectator-histogram/src/main/java/org/apache/druid/spectator/histogram/SpectatorHistogramIndexed.java","lineNumber":153,"sourceCode":"    return strategy.fromByteBuffer(copyValueBuffer, offset.getLength());\n  }\n\n  @Override\n  public int indexOf(@Nullable SpectatorHistogram value)\n  {\n    throw new UnsupportedOperationException(\"Reverse lookup not allowed.\");\n  }\n\n  @Override\n  public Iterator<SpectatorHistogram> iterator()\n  {\n    return IndexedIterable.create(this).iterator();\n  }\n\n  @Override\n  public long getSerializedSize()\n  {\n    throw new UnsupportedOperationException(\"Serialization not supported here\");\n  }\n\n  @Override\n  public void writeTo(WritableByteChannel channel, SegmentFileBuilder fileBuilder)\n  {\n    throw new UnsupportedOperationException(\"Serialization not supported here\");\n  }\n\n  @Override\n  public void inspectRuntimeShape(RuntimeShapeInspector inspector)\n  {\n    inspector.visit(\"headerBuffer\", offsetsHeader);\n    inspector.visit(\"firstValueBuffer\", valueBuffer);\n    inspector.visit(\"strategy\", strategy);\n  }\n\n  @Override\n  public String toString()","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/spectator-histogram/src/main/java/org/apache/druid/spectator/histogram/SpectatorHistogramIndexed.java#L135-L171","documentation":"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.","triggerScenarios":"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).","commonSituations":"Running merge or persist operations over query results containing spectator-histogram dictionary values; framework code that unconditionally measures serialized size before writing.","solutions":["Avoid serializing this Indexed; it is read-only query runtime state.","If persistence is needed, go through SpectatorHistogramSerializer / the column's own serializer instead of Indexed.getSerializedSize().","Check whether the calling framework path should be skipped for this column type."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if (indexed instanceof SpectatorHistogramIndexed) { throw new UnsupportedOperationException(\"serialization not supported; use the column serializer\"); }","typeGuard":"boolean isSerializable(Indexed<?> idx) { return !(idx instanceof SpectatorHistogramIndexed); }","tryCatchPattern":"try { long size = indexed.getSerializedSize(); ... } catch (UnsupportedOperationException e) { throw new IllegalStateException(\"cannot persist runtime histogram dictionary\"); }","preventionTips":["Treat SpectatorHistogramIndexed as read-only query runtime state.","Persist columns only through SpectatorHistogramSerializer during ingestion.","Guard generic Indexed-writer code paths with instanceof checks for unsupported types."],"tags":["java","druid","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}