apache/druid · error · java.lang.UnsupportedOperationException
ApproximateHistogramFoldingBufferAggregator does not…
Error message
ApproximateHistogramFoldingBufferAggregator does not support getFloat()
What it means
ApproximateHistogramFoldingBufferAggregator folds histograms into a ByteBuffer; getFloat() is intentionally unsupported because the buffered result is a histogram object, not a float. Calling it always throws UnsupportedOperationException. Use post-aggregation to extract numeric statistics from the folded histogram.
Solutions
- Use histogram post-aggregators (quantile, min, max, etc.) to compute numeric values from the folded histogram.
- Aggregate the numeric column directly with a float/double-capable aggregator if the histogram is unnecessary.
- Wrap generic accessor calls in a try/catch for UnsupportedOperationException and use object-based access instead.
Example fix
// before
float v = bufferAggregator.getFloat(buf, position);
// after
// query JSON:
// {"type": "quantile", "fieldName": "histFold", "probability": 0.9}
float v = (float) p90Result; Defensive patterns
Strategy: validation
Validate before calling
// Guard buffered fold aggregators before primitive getters:
if (aggregator instanceof org.apache.druid.query.aggregation.histogram.ApproximateHistogramFoldingBufferAggregator) {
// use histogram post-aggregators instead of getFloat()
} Type guard
boolean supportsFloat(Object agg) {
return !(agg instanceof org.apache.druid.query.aggregation.histogram.ApproximateHistogramFoldingBufferAggregator);
} Try / catch
try {
value = aggregator.getFloat(buf, position);
} catch (UnsupportedOperationException e) {
value = (float) quantileFromBuffer(buf, position, 0.5);
} Prevention
- Treat approxHistogramFold buffered results as histogram objects only.
- Route numeric extraction through post-aggregators defined in the query spec.
- Type-check aggregators in generic engines before invoking primitive getters.
When it happens
Trigger: Calling ApproximateHistogramFoldingBufferAggregator.getFloat(ByteBuffer, int), or a query engine requesting a float accessor from a buffer-aggregated approxHistogramFold column.
Common situations: Generic code iterating all buffer aggregators numerically; queries that treat histogram fold results as float metrics; frameworks auto-selecting float accessors based on column naming conventions.
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
- ApproximateHistogramBufferAggregator does not support…
- ApproximateHistogramBufferAggregator does not support…
- ApproximateHistogramBufferAggregator does not support…
- ApproximateHistogramFoldingAggregator does not support…
- ApproximateHistogramFoldingAggregator does not support…
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/95b447ca62d31af0.
Report an issue: GitHub.
Appendix: source
Thrown at extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramFoldingBufferAggregator.java:66
}
@Override
public void aggregate(ByteBuffer buf, int position)
{
ApproximateHistogram hNext = selector.getObject();
innerAggregator.aggregate(buf, position, hNext);
}
@Override
public Object get(ByteBuffer buf, int position)
{
return innerAggregator.get(buf, position);
}
@Override
public float getFloat(ByteBuffer buf, int position)
{
throw new UnsupportedOperationException("ApproximateHistogramFoldingBufferAggregator does not support getFloat()");
}
@Override
public long getLong(ByteBuffer buf, int position)
{
throw new UnsupportedOperationException("ApproximateHistogramFoldingBufferAggregator does not support getLong()");
}
@Override
public double getDouble(ByteBuffer buf, int position)
{
throw new UnsupportedOperationException("ApproximateHistogramFoldingBufferAggregator does not support getDouble()");
}
@Override
public void close()
{
// no resources to cleanupView on GitHub (pinned to 9b90983fd2)