{"record":{"id":"19aaa2137d5a58e2","repo":"apache/druid","slug":"fixedbucketshistogrambufferaggregator-does-not-sup-19aaa2","errorCode":null,"errorMessage":"FixedBucketsHistogramBufferAggregator does not support getDouble()","messagePattern":"FixedBucketsHistogramBufferAggregator does not support getDouble\\(\\)","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":84,"sourceCode":"    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\n  }\n\n  @Override\n  public void inspectRuntimeShape(RuntimeShapeInspector inspector)\n  {\n    inspector.visit(\"selector\", selector);\n  }\n}\n","sourceCodeStart":66,"sourceCodeEnd":99,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramBufferAggregator.java#L66-L99","documentation":"FixedBucketsHistogramBufferAggregator.getDouble() unconditionally throws UnsupportedOperationException. The histogram metric is a complex object and cannot yield a double from its aggregation buffer; the method exists only to satisfy the BufferAggregator interface and always fails.","triggerScenarios":"Any code path calls getDouble() on the buffer for a fixedBucketsHistogram metric, such as a double-typed post-aggregator, SQL DOUBLE projection, or direct framework access to the buffer.","commonSituations":"Users expecting the histogram to behave like a double aggregator (e.g. average) and projecting it as DOUBLE in SQL or native queries; custom vector/frame reading code.","solutions":["Use the provided histogram post-aggregators to extract scalars (e.g. quantile, min, max) before any numeric use.","Set the query to finalize the metric so the result is a serialized FixedBucketsHistogram, handled by the serde.","Treat the column as complex type in the query plan rather than DOUBLE."],"exampleFix":"// before\ndouble v = agg.getDouble(buf, pos);\n// after\n// {\"type\": \"quantile\", \"fieldName\": \"myHist\", \"probability\": 0.95}","handlingStrategy":"type-guard","validationCode":"if (aggregator instanceof FixedBucketsHistogramBufferAggregator) {\n  throw new IllegalStateException(\"Use histogram post-aggregators, not double reads\");\n}","typeGuard":"boolean supportsDouble(BufferAggregator a) {\n  return !(a instanceof FixedBucketsHistogramBufferAggregator);\n}","tryCatchPattern":"try {\n  value = aggregator.getDouble(buf, position);\n} catch (UnsupportedOperationException e) {\n  Object v = aggregator.get(buf, position);\n}","preventionTips":["Do not use DOUBLE-typed projections or DoubleSumPostAggregator directly on histogram metrics.","Extract scalars with quantile/min/max/sum post-aggregators first.","Verify the column signature type is complex before numeric access."],"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"}