{"record":{"id":"db47a5a35987da2e","repo":"apache/druid","slug":"not-implemented-db47a5","errorCode":null,"errorMessage":"Not implemented","messagePattern":"Not implemented","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchBuildAggregator.java","lineNumber":76,"sourceCode":"   * and Druid can call aggregate() and get() concurrently.\n   * See https://github.com/druid-io/druid/pull/3956\n   */\n  @Override\n  public synchronized Object get()\n  {\n    return HllSketchHolder.of(sketch.copy());\n  }\n\n  @Override\n  public void close()\n  {\n    sketch = null;\n  }\n\n  @Override\n  public float getFloat()\n  {\n    throw new UnsupportedOperationException(\"Not implemented\");\n  }\n\n  @Override\n  public long getLong()\n  {\n    throw new UnsupportedOperationException(\"Not implemented\");\n  }\n}\n","sourceCodeStart":58,"sourceCodeEnd":85,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchBuildAggregator.java#L58-L85","documentation":"HllSketchBuildAggregator.getFloat unconditionally throws UnsupportedOperationException because an HLL sketch aggregator produces a sketch (complex object), not a numeric value. Druid calls getFloat only when a query coerces this aggregator's result to a FLOAT, which is meaningless for HLL sketches.","triggerScenarios":"A Druid query requests the HllSketchBuild aggregator's result as a float, e.g. applying numeric post-aggregators or arithmetic to an HLL_SKETCH build aggregator, or selecting it with an output type of FLOAT.","commonSituations":"Writing SQL like AVG over an HLL sketch column, wrapping the sketch aggregator in a arithmetic post-aggregator, or changing a native query's aggregator output type from 'HLLSketch' to float.","solutions":["Don't treat the HLL sketch as a number; use HLLSketchMerge or HLLSketchToString post-aggregators instead.","To get counts, wrap with HLLSketchToCount (+/-) post-aggregator or use APPROX_COUNT_DISTINCT_DS_HLL in SQL.","If you meant a numeric aggregate, switch to the appropriate aggregator (floatSum/longSum) or the correct input column type."],"exampleFix":"// before\n{\"type\": \"HLLSketchBuild\", \"name\": \"s\", \"fieldName\": \"v\"}, {\"type\": \"arithmetic\", \"fn\": \"+\", \"fields\": [\"s\"]}\n// after\n{\"type\": \"HLLSketchBuild\", \"name\": \"s\", \"fieldName\": \"v\"}, {\"type\": \"HLLSketchToCount\", \"name\": \"cnt\", \"field\": \"s\"}","handlingStrategy":"validation","validationCode":"if (aggregatorFactory.getType().startsWith(\"HLLSketch\")) { // must finalize via sketch post-aggregator, not numeric access }","typeGuard":"boolean isNumericAggregator = agg.getType() instanceof String t && !t.contains(\"Sketch\");","tryCatchPattern":"try { float f = aggregator.getFloat(); } catch (UnsupportedOperationException e) { /* use HLLSketchToCount post-aggregator instead */ }","preventionTips":["Never apply numeric post-aggregators to HLL sketch aggregators","Use HLLSketchToCount or APPROX_COUNT_DISTINCT_DS_HLL to obtain counts","Keep sketch aggregator outputType as complex"],"tags":["datasketches","hll","unsupported-operation","aggregation"],"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-14T05:17:10.506Z"}