{"record":{"id":"118d1804ed902223","repo":"apache/druid","slug":"not-implemented-118d18","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/tuple/ArrayOfDoublesSketchBuildAggregator.java","lineNumber":149,"sourceCode":"  /**\n   * This method uses synchronization because it can be used during indexing,\n   * and Druid can call aggregate() and get() concurrently\n   * https://github.com/apache/druid/pull/3956\n   * The returned sketch is a separate instance of ArrayOfDoublesCompactSketch\n   * representing the current state of the aggregation, and is not affected by consequent\n   * aggregate() calls\n   */\n  @Override\n  public synchronized Object get()\n  {\n    initializeSketchIfNeeded();\n    return sketch.compact();\n  }\n\n  @Override\n  public long getLong()\n  {\n    throw new UnsupportedOperationException(\"Not implemented\");\n  }\n\n  @Override\n  public float getFloat()\n  {\n    throw new UnsupportedOperationException(\"Not implemented\");\n  }\n\n  @Override\n  public void close()\n  {\n    sketch = null;\n    values = null;\n  }\n\n  /**\n   * Initialize {@link #sketch} if it is null.\n   */","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchBuildAggregator.java#L131-L167","documentation":"ArrayOfDoublesSketchBuildAggregator aggregates into an ArrayOfDoublesSketch complex object, so numeric accessors like getLong() (and getFloat()) have no meaningful value to return; they unconditionally throw UnsupportedOperationException. This surfaces if a query or metric extraction asks for the aggregation result as a long/float primitive.","triggerScenarios":"Querying an ArrayOfDoublesSketch aggregator column with a numeric accessor — e.g. selecting the raw aggregator output in a context that calls getLong()/getFloat(), or configuring a post-aggregator that reads the sketch value as a number instead of using the tuple sketch specific post-aggregators.","commonSituations":"Using SUM/MIN/MAX or other numeric aggregators directly on the tuple sketch column; selecting the sketch column in SQL where the planner requests a primitive; writing custom code that calls getLong() on the aggregator instead of get() to fetch the sketch object.","solutions":["Use get() to obtain the ArrayOfDoublesSketch object instead of getLong()/getFloat()","Use the tuple-sketch specific post-aggregators (e.g. ArrayOfDoublesSketchTo Estimates/sums) to extract numeric results","In SQL, wrap with the appropriate tuple sketch functions (e.g. DS_DOUBLES_* estimators) rather than casting the sketch to a number"],"exampleFix":"// before\nlong v = aggregator.getLong(); // throws\n// after\nArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) aggregator.get();\ndouble estimate = sketch.getEstimate();","handlingStrategy":"validation","validationCode":"if (aggregator instanceof ArrayOfDoublesSketchBuildAggregator) {\n  Object result = ((ArrayOfDoublesSketchBuildAggregator) aggregator).get(); // use get(), never getLong()\n}","typeGuard":"boolean yieldsNumeric(ArrayOfDoublesSketchBuildAggregator agg) {\n  return false; // numeric accessors are unsupported; always use get()\n}","tryCatchPattern":"try {\n  long v = aggregator.getLong();\n} catch (UnsupportedOperationException e) {\n  ArrayOfDoublesSketch s = (ArrayOfDoublesSketch) aggregator.get();\n  // extract estimates via tuple sketch post-aggregators\n}","preventionTips":["Never use numeric getters on sketch aggregators; call get()","Use tuple-sketch specific post-aggregators for numeric results","In SQL, use DS_DOUBLES_* functions instead of casting sketch columns to numbers"],"tags":["java","datasketches","tuple-sketch"],"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-17T20:17:13.540Z"}