apache/druid · warning · UnsupportedOperationException

Not implemented

Error message

Not implemented

What it means

MomentSketchBuildBufferAggregator.getFloat throws UnsupportedOperationException because the vectorized/buffered sketch aggregator does not support float access; the buffered state holds serialized sketch bytes, which cannot yield a scalar float. It indicates the query engine asked for the aggregation in an unsupported numeric form.

Source

Thrown at extensions-contrib/momentsketch/src/main/java/org/apache/druid/query/aggregation/momentsketch/aggregator/MomentSketchBuildBufferAggregator.java:84

    double x = selector.getDouble();
    ms0.add(x);

    mutationBuffer.position(position);
    ms0.toBytes(mutationBuffer);
  }

  @Override
  public synchronized Object get(final ByteBuffer buffer, final int position)
  {
    ByteBuffer mutationBuffer = buffer.duplicate();
    mutationBuffer.position(position);
    return MomentSketchWrapper.fromBytes(mutationBuffer);
  }

  @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()
  {
  }
}

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Declare the aggregation output as COMPLEX so the engine reads sketch objects instead of floats.
  2. Remove float-typed post-aggregators or column casts applied to the sketch metric.
  3. Use the sketch post-aggregators provided by the extension to extract numeric values.
  4. Check the native query JSON for a configured "type":"FLOAT" on the sketch aggregator and remove it.

Example fix

// before
{"type": "momentsketch", "fieldName": "value", "outputType": "FLOAT"}
// after
{"type": "momentsketch", "fieldName": "value"}
Defensive patterns

Strategy: validation

Validate before calling

// validate native query JSON before submission
if ("FLOAT".equals(aggregatorSpec.get("outputType"))) {
  throw new IllegalArgumentException("momentsketch buffer aggregator does not support FLOAT output");
}

Try / catch

try {
  Float v = bufferAggregator.getFloat(buffer, position);
} catch (UnsupportedOperationException e) {
  // fall back to complex read: MomentSketchWrapper.fromBytes over the buffer region
  MomentSketchWrapper sketch = bufferAggregator.get(buffer, position);
}

Prevention

When it happens

Trigger: Druid's query engine invokes getFloat(buffer, position) on the buffer aggregator, which happens when the momentsketch aggregation is requested with FLOAT output type in a native query or the vectorized path coerces to float.

Common situations: Queries written against numeric aggregations adapted to sketch metrics; SQL planner choosing FLOAT coercion for the column; group-by/timeseries engines accessing the buffer aggregator with a float column type.

Related errors


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