apache/druid · error · java.lang.UnsupportedOperationException

FixedBucketsHistogramBufferAggregator does not support getFl

Error message

FixedBucketsHistogramBufferAggregator does not support getFloat()

What it means

FixedBucketsHistogramBufferAggregator.getFloat() unconditionally throws UnsupportedOperationException. The fixed-buckets histogram is a complex object aggregator whose results are only meaningful as a FixedBucketsHistogram (or its serialized form); it cannot be interpreted as a raw float, so any code path asking for a float value from the aggregation buffer is a programming/query-structure error.

Source

Thrown at extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramBufferAggregator.java:72

  }

  @Override
  public void aggregate(ByteBuffer buf, int position)
  {
    Object val = selector.getObject();
    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

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Use the histogram-specific post-aggregators (quantile, quantiles, min, max, sum, etc.) instead of reading the metric as a float.
  2. Change the query so the metric is finalized (finalize=true output type) and read the serialized histogram via the serde.
  3. Do not treat a fixedBucketsHistogram metric as a numeric column; use NumericPostAggregator on top only after extracting a scalar with a histogram post-agg.

Example fix

// before: reading metric directly as float
Float v = rows.getFloat("myHist");
// after: use a post-aggregator
// {"type": "quantile", "fieldName": "myHist", "probability": 0.5}
Defensive patterns

Strategy: type-guard

Validate before calling

if (aggregator instanceof FixedBucketsHistogramBufferAggregator) {
  throw new IllegalStateException("Use histogram post-aggregators, not float reads");
}

Type guard

boolean isNumericAggregator(BufferAggregator a) {
  return !(a instanceof FixedBucketsHistogramBufferAggregator);
}

Try / catch

try {
  value = aggregator.getFloat(buf, position);
} catch (UnsupportedOperationException e) {
  // fall back to object-based access
  Object v = aggregator.get(buf, position);
}

Prevention

When it happens

Trigger: A query or framework path calls getFloat() on the buffer aggregator's output column, e.g. the aggregator is used as a finalizer target or nested in a post-aggregator/frame expecting a primitive float-typed metric.

Common situations: Using fixedBucketsHistogram as the output of a groupBy/rollup where downstream code assumes numeric metric access; SQL planner treating the metric as FLOAT; custom code reading the aggregation buffer directly.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/7e29e27a4d3ce7ce. Report an issue: GitHub.