{"record":{"id":"7e29e27a4d3ce7ce","repo":"apache/druid","slug":"fixedbucketshistogrambufferaggregator-does-not-sup","errorCode":null,"errorMessage":"FixedBucketsHistogramBufferAggregator does not support getFloat()","messagePattern":"FixedBucketsHistogramBufferAggregator does not support getFloat\\(\\)","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramBufferAggregator.java","lineNumber":72,"sourceCode":"  }\n\n  @Override\n  public void aggregate(ByteBuffer buf, int position)\n  {\n    Object val = selector.getObject();\n    innerAggregator.aggregate(buf, position, val);\n  }\n\n  @Override\n  public Object get(ByteBuffer buf, int position)\n  {\n    return innerAggregator.get(buf, position);\n  }\n\n  @Override\n  public float getFloat(ByteBuffer buf, int position)\n  {\n    throw new UnsupportedOperationException(\"FixedBucketsHistogramBufferAggregator does not support getFloat()\");\n  }\n\n  @Override\n  public long getLong(ByteBuffer buf, int position)\n  {\n    throw new UnsupportedOperationException(\"FixedBucketsHistogramBufferAggregator does not support getLong()\");\n  }\n\n  @Override\n  public double getDouble(ByteBuffer buf, int position)\n  {\n    throw new UnsupportedOperationException(\"FixedBucketsHistogramBufferAggregator does not support getDouble()\");\n  }\n\n  @Override\n  public void close()\n  {\n    // no resources to cleanup","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramBufferAggregator.java#L54-L90","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use the histogram-specific post-aggregators (quantile, quantiles, min, max, sum, etc.) instead of reading the metric as a float.","Change the query so the metric is finalized (finalize=true output type) and read the serialized histogram via the serde.","Do not treat a fixedBucketsHistogram metric as a numeric column; use NumericPostAggregator on top only after extracting a scalar with a histogram post-agg."],"exampleFix":"// before: reading metric directly as float\nFloat v = rows.getFloat(\"myHist\");\n// after: use a post-aggregator\n// {\"type\": \"quantile\", \"fieldName\": \"myHist\", \"probability\": 0.5}","handlingStrategy":"type-guard","validationCode":"if (aggregator instanceof FixedBucketsHistogramBufferAggregator) {\n  throw new IllegalStateException(\"Use histogram post-aggregators, not float reads\");\n}","typeGuard":"boolean isNumericAggregator(BufferAggregator a) {\n  return !(a instanceof FixedBucketsHistogramBufferAggregator);\n}","tryCatchPattern":"try {\n  value = aggregator.getFloat(buf, position);\n} catch (UnsupportedOperationException e) {\n  // fall back to object-based access\n  Object v = aggregator.get(buf, position);\n}","preventionTips":["Never read complex-type metrics as primitives; use post-aggregators to extract scalars.","Check the aggregation factory's getType()/Comparator to confirm the metric is numeric before calling getFloat.","Use finalize output for histogram metrics and deserialize via the serde.","Document that fixedBucketsHistogram results must flow through histogram post-aggs."],"tags":["druid","histogram","unsupported-operation"],"backgroundTag":"method-not-implemented","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}