apache/druid · error · java.lang.UnsupportedOperationException
ApproximateHistogramFoldingAggregator does not support getDo
Error message
ApproximateHistogramFoldingAggregator does not support getDouble()
What it means
ApproximateHistogramFoldingAggregator.getDouble() is intentionally unimplemented because the aggregation result is an ApproximateHistogram, not a double. The method unconditionally throws UnsupportedOperationException; numeric results must come from histogram post-aggregators.
Source
Thrown at extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramFoldingAggregator.java:84
return histogram;
}
@Override
public float getFloat()
{
throw new UnsupportedOperationException("ApproximateHistogramFoldingAggregator does not support getFloat()");
}
@Override
public long getLong()
{
throw new UnsupportedOperationException("ApproximateHistogramFoldingAggregator does not support getLong()");
}
@Override
public double getDouble()
{
throw new UnsupportedOperationException("ApproximateHistogramFoldingAggregator does not support getDouble()");
}
@Override
public void close()
{
// no resources to cleanup
}
}
View on GitHub (pinned to 9b90983fd2)
Solutions
- Use quantile/min/max/custom histogram post-aggregators to obtain double values.
- Use doubleSum/doubleMin/doubleMax on the raw column if the histogram is not actually needed.
- Catch UnsupportedOperationException in generic code and handle non-numeric aggregators explicitly.
Example fix
// before
double v = foldingAggregator.getDouble();
// after
// query JSON:
// {"type": "quantiles", "fieldName": "histFold", "probabilities": [0.5, 0.95]}
double v = quantilesResult[0]; Defensive patterns
Strategy: validation
Validate before calling
// Guard getDouble on folding aggregators:
if (aggregator instanceof org.apache.druid.query.aggregation.histogram.ApproximateHistogramFoldingAggregator) {
// unsupported; use quantile/min/max post-aggregators
} Type guard
boolean supportsDouble(Object agg) {
return !(agg instanceof org.apache.druid.query.aggregation.histogram.ApproximateHistogramFoldingAggregator);
} Try / catch
try {
value = aggregator.getDouble();
} catch (UnsupportedOperationException e) {
value = histogramQuantile(aggregator.get(), 0.5);
} Prevention
- Review query specs so histogram folds always feed histogram post-aggs.
- Search query templates for direct accessor calls on approxHistogramFold fields.
- Fail fast in custom engines when an aggregator type lacks numeric getters.
When it happens
Trigger: Calling ApproximateHistogramFoldingAggregator.getDouble(), or running a query whose result accessor invokes getDouble on an approxHistogramFold aggregation.
Common situations: Queries expecting double output from all aggregators; generic result-extraction loops; misconfigured queries where a double metric column was replaced by a histogram fold.
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 getFlo
- ApproximateHistogramBufferAggregator does not support getLon
- ApproximateHistogramBufferAggregator does not support getDou
- ApproximateHistogramFoldingAggregator does not support getFl
- ApproximateHistogramFoldingAggregator does not support getLo
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/33556080185fe6e8.
Report an issue: GitHub.