apache/druid · warning · UnsupportedOperationException

Not implemented

Error message

Not implemented

What it means

MomentSketchMergeBufferAggregator.getFloat throws UnsupportedOperationException because the buffered merge aggregator holds serialized sketch bytes and cannot produce a scalar float. It fires when the vectorized query engine requests the merged sketch aggregation as FLOAT.

Source

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

    MomentSketchWrapper ms0 = MomentSketchWrapper.fromBytes(mutationBuffer);
    ms0.merge(msNext);

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

  @Override
  public Object get(ByteBuffer buf, int position)
  {
    ByteBuffer mutationBuffer = buf.asReadOnlyBuffer();
    mutationBuffer.position(position);
    return MomentSketchWrapper.fromBytes(mutationBuffer);
  }

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

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

  @Override
  public double getDouble(ByteBuffer buf, int position)
  {
    throw new UnsupportedOperationException("Not implemented");
  }

  @Override
  public void close()
  {
  }

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Declare the merged sketch aggregation as COMPLEX output type.
  2. Remove float casts/post-aggregators from the sketch metric.
  3. Use sketch post-aggregators to derive numeric values from the merged sketch.
  4. Disable vectorization coercion or verify the native query JSON has no FLOAT outputType on the sketch aggregator.

Example fix

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

Strategy: validation

Validate before calling

// reject unsupported output types in merged/vectorized sketch specs
if ("FLOAT".equals(aggregatorSpec.get("outputType"))) {
  throw new IllegalArgumentException("momentsketch merge buffer aggregator does not support FLOAT output");
}

Try / catch

try {
  float v = mergeBufferAggregator.getFloat(buf, position);
} catch (UnsupportedOperationException e) {
  MomentSketchWrapper sketch = mergeBufferAggregator.get(buf, position);
}

Prevention

When it happens

Trigger: A vectorized (buffer aggregator) query path coerces the merged momentsketch metric to FLOAT output type, causing getFloat(buf, position) to be called.

Common situations: Group-by/timeseries queries with float output coercion on sketch metrics; SQL planner float casts; reporting tooling assuming all aggregations are numeric.

Related errors


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