apache/druid · error · IllegalArgumentException
Expected a long or a SpectatorHistogramMap, but received
Error message
Expected a long or a SpectatorHistogramMap, but received [%s] of type [%s]
What it means
SpectatorHistogramAggregator.aggregate received a selector value that is neither a Number nor a SpectatorHistogram. The aggregator expects either a plain long/numeric value or a histogram object produced by the matching column serializer; any other object (e.g. a String, Map, or a histogram from an incompatible serializer) is rejected, indicating a column-type/aggregator mismatch in the query spec.
Solutions
- Check the query's aggregator spec: the spectatorHistogram aggregator must target a column serialized as SpectatorHistogram or numeric values.
- Verify the input source's column type matches (e.g. not a string or complex type from another extension).
- Inspect the logged object's type to identify which serializer produced the unexpected value.
- Fix the query or the ingestion spec so the column's serialization matches the aggregator's expectations.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at extensions-contrib/spectator-histogram/src/main/java/org/apache/druid/spectator/histogram/SpectatorHistogramAggregator.java:65 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/98e2aa7b40fe07ab.
Report an issue: GitHub.
Appendix: source
Thrown at extensions-contrib/spectator-histogram/src/main/java/org/apache/druid/spectator/histogram/SpectatorHistogramAggregator.java:65
@Override
public void aggregate()
{
Object obj = selector.getObject();
if (obj == null) {
return;
}
if (obj instanceof SpectatorHistogram) {
SpectatorHistogram other = (SpectatorHistogram) obj;
synchronized (this) {
counts.merge(other);
}
} else if (obj instanceof Number) {
synchronized (this) {
counts.insert((Number) obj);
}
} else {
throw new IAE(
"Expected a long or a SpectatorHistogramMap, but received [%s] of type [%s]",
obj,
obj.getClass()
);
}
}
@Nullable
@Override
public synchronized Object get()
{
return counts.isEmpty() ? null : counts;
}
@Override
public synchronized float getFloat()
{
return counts.getSum();View on GitHub (pinned to 9b90983fd2)