apache/druid · error · java.lang.UnsupportedOperationException
FixedBucketsHistogramBufferAggregator does not support getLo
Error message
FixedBucketsHistogramBufferAggregator does not support getLong()
What it means
FixedBucketsHistogramBufferAggregator.getLong() unconditionally throws UnsupportedOperationException. A fixed-buckets histogram cannot be represented as a long, so any request to read the aggregation buffer as a long is invalid; the library fails fast rather than returning a meaningless value.
Source
Thrown at extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramBufferAggregator.java:78
innerAggregator.aggregate(buf, position, val);
}
@Override
public Object get(ByteBuffer buf, int position)
{
return innerAggregator.get(buf, position);
}
@Override
public float getFloat(ByteBuffer buf, int position)
{
throw new UnsupportedOperationException("FixedBucketsHistogramBufferAggregator does not support getFloat()");
}
@Override
public long getLong(ByteBuffer buf, int position)
{
throw new UnsupportedOperationException("FixedBucketsHistogramBufferAggregator does not support getLong()");
}
@Override
public double getDouble(ByteBuffer buf, int position)
{
throw new UnsupportedOperationException("FixedBucketsHistogramBufferAggregator does not support getDouble()");
}
@Override
public void close()
{
// no resources to cleanup
}
@Override
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
{
inspector.visit("selector", selector);View on GitHub (pinned to 9b90983fd2)
Solutions
- Access the histogram via histogram-specific post-aggregators (quantile, min, max, sum) instead of raw long reads.
- Ensure the query's output type for this metric is the complex/finalized histogram type, not LONG.
- Refactor downstream code to consume FixedBucketsHistogram objects or their serialized base64 form.
Example fix
// before
Long v = agg.getLong(buf, pos);
// after: apply a scalar-extracting post-aggregator first
// {"type": "max", "fieldName": "myHist"} Defensive patterns
Strategy: type-guard
Validate before calling
if (aggregator instanceof FixedBucketsHistogramBufferAggregator) {
throw new IllegalStateException("Use histogram post-aggregators, not long reads");
} Type guard
boolean supportsLong(BufferAggregator a) {
return !(a instanceof FixedBucketsHistogramBufferAggregator);
} Try / catch
try {
value = aggregator.getLong(buf, position);
} catch (UnsupportedOperationException e) {
Object v = aggregator.get(buf, position);
} Prevention
- Avoid projecting fixedBucketsHistogram metrics as BIGINT/LONG in SQL or native queries.
- Use histogram post-aggregators (min, max, quantile, sum) to obtain numeric values.
- Check the aggregator's comparator/type before numeric buffer access.
When it happens
Trigger: A query execution path or custom aggregation framework invokes getLong() on the buffer for a fixedBucketsHistogram metric, e.g. a long-typed expectation from the column signature or a numeric post-aggregator applied directly to the histogram metric.
Common situations: Pointing a LongSumPostAggregator or SQL BIGINT-typed projection at a fixedBucketsHistogram column; framework code assuming all aggregators produce numeric buffers.
Related errors
- FixedBucketsHistogramBufferAggregator does not support getFl
- FixedBucketsHistogramBufferAggregator does not support getDo
- extractValue without an aggregator factory is not supported.
- HistogramAggregator does not support getLong()
- HistogramAggregator does not support getDouble()
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/8620c3e4c3104d26.
Report an issue: GitHub.