apache/druid · error · UnsupportedOperationException

Not implemented

Error message

Not implemented

What it means

DoublesSketchBuildBufferAggregator.getFloat(ByteBuffer,int) is a required BufferAggregator method that this class intentionally leaves unimplemented because a sketch cannot be read as a float. The exception indicates the query is trying to extract a numeric primitive from a sketch buffer slot.

Source

Thrown at extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchBuildBufferAggregator.java:73

    if (selector.isNull()) {
      return;
    }

    final UpdateDoublesSketch sketch = helper.getSketchAtPosition(buffer, position);
    sketch.update(selector.getDouble());
  }

  @Nullable
  @Override
  public Object get(ByteBuffer buf, int position)
  {
    return helper.get(buf, position);
  }

  @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()
  {
    helper.clear();
  }

  // A small number of sketches may run out of the given memory, request more memory on heap and move there.
  // In that case we need to reuse the object from the cache as opposed to wrapping the new buffer.
  @Override
  public void relocate(int oldPosition, int newPosition, ByteBuffer oldBuffer, ByteBuffer newBuffer)

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Use get(buf, position) which returns the sketch (or finalized value) object
  2. Convert the column signature to a TYPE_COMPLEX (sketch) selector instead of a float selector
  3. Extract numeric metrics with sketch post-aggregators instead of raw buffer reads

Example fix

// before
float v = agg.getFloat(buf, position);
// after
Object v = agg.get(buf, position); // sketch or finalized value
Defensive patterns

Strategy: type-guard

Validate before calling

Object v = bufferAggregator.get(buffer, position);
if (v instanceof Number) { /* numeric path */ } else { /* sketch path: use sketch API */ }

Type guard

boolean isComplexSketchColumn(ColumnCapabilities caps) {
  return caps.getType().equals(ValueType.COMPLEX);
}

Try / catch

try {
  return agg.getFloat(buffer, position);
} catch (UnsupportedOperationException e) {
  return Float.NaN; // sketch column: handle via get(buffer, position) and post-aggregation
}

Prevention

When it happens

Trigger: Calling getFloat(buffer, position) on the buffer aggregator for a quantilesDoublesSketch aggregation, e.g. when a query engine or column signature treats the sketch column as a float numeric column.

Common situations: Mismatched ColumnValueSelector / column type signatures in custom query engines; tests or tools that read buffer aggregator values generically as floats.

Related errors


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