apache/druid · error · UnsupportedOperationException

Not implemented

Error message

Not implemented

What it means

DDSketchBufferAggregator.getFloat() is not implemented: sketches held in the aggregation buffer cannot be read as a float primitive. UnsupportedOperationException is thrown intentionally whenever the engine attempts to extract a float from the buffer-aggregated sketch.

Source

Thrown at extensions-contrib/ddsketch/src/main/java/org/apache/druid/query/aggregation/ddsketch/DDSketchBufferAggregator.java:103

          x,
          x.getClass()
      );
    }
  }

  @Override
  public Object get(final ByteBuffer buffer, final int position)
  {
    // sketchCache is an IdentityHashMap where the reference of buffer is used for equality checks.
    // So the returned object isn't impacted by the changes in the buffer object made by concurrent threads.
    DDSketch obj = sketchCache.get(buffer).get(position);
    return obj;
  }

  @Override
  public float getFloat(final ByteBuffer buffer, final int position)
  {
    throw new UnsupportedOperationException("Not implemented");
  }

  @Override
  public long getLong(final ByteBuffer buffer, final int position)
  {
    throw new UnsupportedOperationException("Not implemented");
  }

  @Override
  public void close()
  {
    sketchCache.clear();
  }

  @Override
  public void relocate(int oldPosition, int newPosition, ByteBuffer oldBuffer, ByteBuffer newBuffer)
  {
    DDSketch sketch = sketchCache.get(oldBuffer).get(oldPosition);

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Access the sketch result via ddsketchQuantile/ddsketchQuantiles post-aggregators, not as a float.
  2. Keep ddsketch results as complex objects (sketch columns) and only extract numbers in post-aggregation.
  3. Use a numeric aggregator if a float result is genuinely required.

Example fix

// before
float v = agg.getFloat(); // UnsupportedOperationException
// after
DDSketch sketch = (DDSketch) agg.get();
double p90 = sketch.getValueAtQuantile(0.9);
Defensive patterns

Strategy: fallback

Type guard

Object o = agg.get(buffer, position);
if (o instanceof DDSketch) { /* handle as sketch */ }

Try / catch

try {
  return agg.getFloat(buffer, position);
} catch (UnsupportedOperationException e) {
  return ((DDSketch) agg.get(buffer, position)).getCount() > 0 ? (float) agg.computeQuantile(buffer, position, 0.5) : Float.NaN;
}

Prevention

When it happens

Trigger: Running a query whose execution plan (e.g. group-by with certain accessors, or non-vectorized paths) calls getFloat on the ddsketch buffer aggregator's result, or finalizing the result as a float metric.

Common situations: GroupBy queries treating the sketch result as a numeric metric, using float-typed accessors/finalizers, or custom accessors built for numeric aggregators.

Related errors


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