{"record":{"id":"cdf9001b486fca4b","repo":"apache/druid","slug":"not-implemented-cdf900","errorCode":null,"errorMessage":"Not implemented","messagePattern":"Not implemented","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/theta/SketchAggregator.java","lineNumber":113,"sourceCode":"  public Object get()\n  {\n    if (union == null) {\n      return SketchHolder.EMPTY;\n    }\n    //in the code below, I am returning SetOp.getResult(true, null)\n    //\"true\" returns an ordered sketch but slower to compute than unordered sketch.\n    //however, advantage of ordered sketch is that they are faster to \"union\" later\n    //given that results from the aggregator will be combined further, it is better\n    //to return the ordered sketch here\n    synchronized (this) {\n      return SketchHolder.of(union.getResult(true, null));\n    }\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 double getDouble()\n  {\n    throw new UnsupportedOperationException(\"Not implemented\");\n  }\n\n  @Override\n  public void close()\n  {\n    union = null;","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/theta/SketchAggregator.java#L95-L131","documentation":"SketchAggregator (theta sketches) only supports get() returning the sketch object and getDouble(); getFloat is intentionally unimplemented and throws UnsupportedOperationException. Theta sketches are binary objects, not float values, so a float read is meaningless.","triggerScenarios":"A theta sketch aggregation (e.g. sketchMerge) is accessed via a FLOAT output type or float post-aggregator; generic aggregator iteration calls getFloat().","commonSituations":"Declaring outputType FLOAT for a theta sketch metric; third-party query tools that call getFloat on all aggregators; miswritten post-aggregators over sketch columns.","solutions":["Call get() and use sketch post-aggregators instead of float access","Change the declared output type to object/DOUBLE as appropriate","Use sketchEstimate post-aggregator to get a numeric estimate rather than float access"],"exampleFix":"// before\n{\"type\":\"float\",\"fieldName\":\"sketch\"} // output type\n// after\n{\"type\":\"sketchEstimate\",\"field\":{\"type\":\"thetaSketch\",\"fieldName\":\"sketch\"}}","handlingStrategy":"validation","validationCode":"if (agg instanceof SketchAggregator && \"float\".equals(outputType)) { throw new IllegalArgumentException(\"thetaSketch does not support FLOAT output; use sketchEstimate post-aggregator\"); }","typeGuard":"boolean isThetaNumericReadable(Aggregator a) { return !(a instanceof SketchAggregator); }","tryCatchPattern":"try { f = agg.getFloat(); } catch (UnsupportedOperationException e) { f = (float)((Sketch) agg.get()).getEstimate(); }","preventionTips":["Use sketchEstimate post-aggregator for numeric theta sketch values","Declare sketch aggregator outputType as object or omit it","Check aggregator class before calling numeric accessors"],"tags":["java","datasketches","theta-sketch","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"}