apache/druid · error · UnsupportedOperationException
HistogramBufferAggregator does not support getFloat()
Error message
HistogramBufferAggregator does not support getFloat()
What it means
HistogramBufferAggregator is the off-heap (ByteBuffer-based) variant of the histogram aggregator in Druid. Its getFloat() is intentionally unimplemented: a histogram aggregate cannot be represented as a single float, so the method throws UnsupportedOperationException. The error indicates the query framework attempted float-valued access on a histogram metric.
Source
Thrown at processing/src/main/java/org/apache/druid/query/aggregation/HistogramBufferAggregator.java:93
}
@Override
public Object get(ByteBuffer buf, int position)
{
long[] bins = new long[breaks.length + 1];
ByteBuffer mutationBuffer = buf.duplicate();
mutationBuffer.position(position);
mutationBuffer.asLongBuffer().get(bins);
float min = mutationBuffer.getFloat(position + minOffset);
float max = mutationBuffer.getFloat(position + maxOffset);
return new Histogram(breaks, bins, min, max);
}
@Override
public float getFloat(ByteBuffer buf, int position)
{
throw new UnsupportedOperationException("HistogramBufferAggregator does not support getFloat()");
}
@Override
public long getLong(ByteBuffer buf, int position)
{
throw new UnsupportedOperationException("HistogramBufferAggregator does not support getLong()");
}
@Override
public double getDouble(ByteBuffer buf, int position)
{
throw new UnsupportedOperationException("HistogramBufferAggregator does not support getDouble");
}
@Override
public void close()
{
// no resources to cleanupView on GitHub (pinned to 9b90983fd2)
Solutions
- Retrieve the histogram result via get(ByteBuffer, int), which returns the Histogram object.
- Use a float-producing aggregator (floatSum, doubleSum) instead of histogram when a FLOAT output is needed.
- Remove FLOAT coercion/post-aggregators from the histogram metric in the query spec.
- If histogram statistics are needed, finalize the histogram and aggregate over its bins downstream.
Example fix
// before float f = bufferAgg.getFloat(buf, position); // throws // after Object val = bufferAgg.get(buf, position); Histogram hist = (Histogram) val;
Defensive patterns
Strategy: type-guard
Validate before calling
if (bufferAggregator instanceof HistogramBufferAggregator) {
// must use get(buf, position); never call getFloat()
} Type guard
boolean supportsFloat(BufferAggregator agg) {
return !(agg instanceof HistogramBufferAggregator);
} Try / catch
try {
value = agg.getFloat(buf, position);
} catch (UnsupportedOperationException e) {
Object h = agg.get(buf, position);
} Prevention
- Branch on aggregator type before calling primitive getters on buffer aggregators
- Keep FLOAT post-aggregators away from histogram metrics
- Validate the query spec's metric types at plan time
- Use get(ByteBuffer,int) for object-typed aggregators
When it happens
Trigger: A native query using a 'histogram' aggregator is executed in a buffer-based engine path (groupBy/older timeseries) where the metric is retrieved via BufferAggregator.getFloat(); e.g. a float-typed post-aggregator or FLOAT coercion applied to the histogram column.
Common situations: FLOAT-typed SQL aggregation over a histogram column; post-aggregator chains that default to float accessors; custom engine code calling getFloat() on buffer aggregators without checking the aggregator type; queries written for numeric aggregators retargeted to histogram.
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
- HistogramBufferAggregator does not support getLong()
- HistogramBufferAggregator does not support getDouble
- StringFirstAggregator does not support getFloat()
- StringFirstAggregator does not support getLong()
- StringFirstAggregator does not support getDouble()
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/5d3cfdc557885f76.
Report an issue: GitHub.