{"record":{"id":"dc4071138d3b1df7","repo":"apache/druid","slug":"not-implemented-dc4071","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/tuple/NoopArrayOfDoublesSketchAggregator.java","lineNumber":50,"sourceCode":"  {\n    emptySketch = new ArrayOfDoublesUpdatableSketchBuilder().setNumberOfValues(numberOfValues).build().compact();\n  }\n\n  @Override\n  public void aggregate()\n  {\n  }\n\n  @Override\n  public Object get()\n  {\n    return emptySketch;\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  @Override\n  public void close()\n  {\n  }\n\n}\n","sourceCodeStart":32,"sourceCodeEnd":65,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/tuple/NoopArrayOfDoublesSketchAggregator.java#L32-L65","documentation":"NoopArrayOfDoublesSketchAggregator exists only to hold/place a sketch during intermediate aggregation; it produces sketch objects, not scalar numbers. Consequently getFloat() (and getLong()) throw UnsupportedOperationException('Not implemented') because reading a float from a sketch aggregator is meaningless in this implementation.","triggerScenarios":"Calling getFloat() on a NoopArrayOfDoublesSketchAggregator instance, e.g. framework code that drains finalizer results via the primitive accessors, or misuse of the aggregator outside its intended sketch buffer role.","commonSituations":"Custom aggregation code iterating all aggregators and calling getFloat()/getLong() uniformly; wiring this noop aggregator into a metric expecting a numeric result.","solutions":["Use the object accessor (get()/sketch retrieval) instead of getFloat() to obtain the ArrayOfDoublesSketch","Use ArrayOfDoublesSketchAggregator or a numeric aggregator factory when a float result is required","Guard aggregator draining code to only call getFloat() on aggregators whose factory produces numeric values"],"exampleFix":"// before\nfloat f = aggregator.getFloat();\n// after\nObject sketch = aggregator.get();\nif (sketch instanceof ArrayOfDoublesSketch) { /* use sketch */ }","handlingStrategy":"type-guard","validationCode":"if (aggregator instanceof NoopArrayOfDoublesSketchAggregator) {\n  throw new UnsupportedOperationException(\"Use get() to obtain the sketch, not getFloat()/getLong()\");\n}","typeGuard":"boolean yieldsScalar(Aggregator aggregator) {\n  return !(aggregator instanceof NoopArrayOfDoublesSketchAggregator);\n}","tryCatchPattern":"try {\n  return aggregator.getFloat();\n} catch (UnsupportedOperationException e) {\n  if (\"Not implemented\".equals(e.getMessage())) {\n    Object sketch = aggregator.get();\n    return sketch instanceof ArrayOfDoublesSketch ? deriveScalarFrom((ArrayOfDoublesSketch) sketch) : 0f;\n  }\n  throw e;\n}","preventionTips":["Never call primitive accessors (getFloat/getLong) on sketch-valued aggregators","Drain results based on the aggregator factory's known output type","Use ArrayOfDoublesSketchAggregatorFactory-compatible finalizers when scalar values are needed"],"tags":["druid","datasketches","not-implemented"],"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-17T15:17:12.973Z"}