apache/druid · error · UnsupportedOperationException

Not implemented

Error message

Not implemented

What it means

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.

Solutions

  1. Use the object accessor (get()/sketch retrieval) instead of getFloat() to obtain the ArrayOfDoublesSketch
  2. Use ArrayOfDoublesSketchAggregator or a numeric aggregator factory when a float result is required
  3. Guard aggregator draining code to only call getFloat() on aggregators whose factory produces numeric values

Example fix

// before
float f = aggregator.getFloat();
// after
Object sketch = aggregator.get();
if (sketch instanceof ArrayOfDoublesSketch) { /* use sketch */ }
Defensive patterns

Strategy: type-guard

Validate before calling

if (aggregator instanceof NoopArrayOfDoublesSketchAggregator) {
  throw new UnsupportedOperationException("Use get() to obtain the sketch, not getFloat()/getLong()");
}

Type guard

boolean yieldsScalar(Aggregator aggregator) {
  return !(aggregator instanceof NoopArrayOfDoublesSketchAggregator);
}

Try / catch

try {
  return aggregator.getFloat();
} catch (UnsupportedOperationException e) {
  if ("Not implemented".equals(e.getMessage())) {
    Object sketch = aggregator.get();
    return sketch instanceof ArrayOfDoublesSketch ? deriveScalarFrom((ArrayOfDoublesSketch) sketch) : 0f;
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Custom aggregation code iterating all aggregators and calling getFloat()/getLong() uniformly; wiring this noop aggregator into a metric expecting a numeric result.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/dc4071138d3b1df7. Report an issue: GitHub.

Appendix: source

Thrown at extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/tuple/NoopArrayOfDoublesSketchAggregator.java:50

  {
    emptySketch = new ArrayOfDoublesUpdatableSketchBuilder().setNumberOfValues(numberOfValues).build().compact();
  }

  @Override
  public void aggregate()
  {
  }

  @Override
  public Object get()
  {
    return emptySketch;
  }

  @Override
  public float getFloat()
  {
    throw new UnsupportedOperationException("Not implemented");
  }

  @Override
  public long getLong()
  {
    throw new UnsupportedOperationException("Not implemented");
  }

  @Override
  public void close()
  {
  }

}

View on GitHub (pinned to 9b90983fd2)