apache/druid · error · java.lang.UnsupportedOperationException
Unknown type:
Error message
Unknown type:
What it means
FixedBucketsHistogramSerde's extractValue throws UnsupportedOperationException('Unknown type: <class>') when the raw column value is neither a FixedBucketsHistogram, a String (base64 or JSON-encoded histogram), nor another recognized type. The serde only knows how to deserialize histograms from a small set of input representations.
Source
Thrown at extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramSerde.java:117
} else if (rawValue instanceof String) {
Number numberAttempt;
try {
numberAttempt = Rows.objectToNumber(metricName, rawValue, true);
FixedBucketsHistogram fbh = new FixedBucketsHistogram(
aggregatorFactory.getLowerLimit(),
aggregatorFactory.getUpperLimit(),
aggregatorFactory.getNumBuckets(),
aggregatorFactory.getOutlierHandlingMode()
);
fbh.add(numberAttempt.doubleValue());
return fbh;
}
catch (ParseException pe) {
FixedBucketsHistogram fbh = FixedBucketsHistogram.fromBase64((String) rawValue);
return fbh;
}
} else {
throw new UnsupportedOperationException("Unknown type: " + rawValue.getClass());
}
}
};
}
@Override
public ObjectStrategy getObjectStrategy()
{
return new ObjectStrategy<FixedBucketsHistogram>()
{
@Override
public Class<? extends FixedBucketsHistogram> getClazz()
{
return FixedBucketsHistogram.class;
}
@Override
public FixedBucketsHistogram fromByteBuffer(ByteBuffer buffer, int numBytes)View on GitHub (pinned to 9b90983fd2)
Solutions
- Ensure the raw value is a String containing a base64-encoded FixedBucketsHistogram or a JSON-encoded histogram (or an actual FixedBucketsHistogram object).
- Fix the upstream producer/ingestion spec so the histogram is serialized with FixedBucketsHistogram.toBase64() before ingestion.
- Add a preprocessing step (e.g. a parseSpec/flatten transform) that converts the value to the expected base64 string.
Example fix
// before: ingesting a raw number
row.add("myHist", 42);
// after
row.add("myHist", FixedBucketsHistogram.toBase64(fbh)); Defensive patterns
Strategy: validation
Validate before calling
Object raw = row.getRaw("myHist");
if (!(raw == null || raw instanceof FixedBucketsHistogram || raw instanceof String)) {
throw new IllegalArgumentException("myHist must be base64/JSON histogram string, got " + raw.getClass());
} Type guard
boolean isHistogramValue(Object v) {
return v instanceof FixedBucketsHistogram ||
(v instanceof String); // base64 or JSON-encoded histogram
} Try / catch
try {
Object v = serde.extractValue(row, "myHist", aggFactory);
} catch (UnsupportedOperationException e) {
// handle/log unexpected raw type, e.g. re-serialize producer data
} Prevention
- Producers must serialize histograms with FixedBucketsHistogram.toBase64() before ingestion.
- Validate sample rows against expected types before submitting ingestion jobs.
- Do not map numeric fields to fixedBucketsHistogram metrics in ingestion specs.
When it happens
Trigger: Ingesting rows where the metric column holds a value of an unexpected Java class (e.g. Number, Map, byte[]) for a fixedBucketsHistogram metric; the serde falls through all instanceof checks and throws.
Common situations: Ingestion specs with wrong-type input (numeric field mapped to a histogram metric), programmatic row construction putting raw objects in, or upstream producers writing the histogram in an unencodable format.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- extractValue without an aggregator factory is not supported.
- Unknown value type:
- Unknown value type:
- Cannot deserialize type[%s] to an RoaringBitmap64Counter:
- Expected a number or an instance of MergingDigest, but recei
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/43e3b6823deda459.
Report an issue: GitHub.