apache/druid · error · UnsupportedOperationException

Not implemented

Error message

Not implemented

What it means

KllSketchBuildAggregator accumulates values into a KllFloatsSketch object; its final result is the sketch itself, which is not a float. getFloat() is implemented only to satisfy the Aggregator interface and always throws UnsupportedOperationException. It indicates the aggregator was invoked through a numeric access path that doesn't apply to sketch aggregators.

Source

Thrown at extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/kll/KllSketchBuildAggregator.java:48

  protected final ColumnValueSelector<ValueType> valueSelector;
  @Nullable protected SketchType sketch;

  KllSketchBuildAggregator(final ColumnValueSelector<ValueType> valueSelector, final SketchType sketch)
  {
    this.valueSelector = valueSelector;
    this.sketch = sketch;
  }

  @Override
  public synchronized Object get()
  {
    return sketch;
  }

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

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

  @Override
  public synchronized void close()
  {
    sketch = null;
  }
}

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Retrieve the sketch result via getObject()/the object result path, not getFloat().
  2. Ensure the aggregation's declared output type is the sketch object type, not float/double.
  3. If this arises inside custom extension code, special-case sketch aggregators before numeric extraction.

Example fix

// before
float v = agg.getFloat();

// after
Object result = ((KllSketchBuildAggregator) agg).get(); // returns KllFloatsSketch
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(aggregator instanceof KllSketchBuildAggregator)) {
  float v = aggregator.getFloat();
}

Type guard

static Float safeGetFloat(Aggregator agg) {
  if (agg instanceof KllSketchBuildAggregator) return null; // sketch-valued, not numeric
  return agg.getFloat();
}

Try / catch

try {
  float v = agg.getFloat();
} catch (UnsupportedOperationException e) {
  // sketch aggregator: retrieve object result instead
  Object sketch = agg.getObject();
}

Prevention

When it happens

Trigger: Druid (or custom code) calling agg.getFloat() on a KLL sketch aggregator — typically when the engine expects a numeric-valued aggregator, e.g. a misconfigured row-signature/type or code iterating aggregators assuming numeric output.

Common situations: Custom query tooling or extensions that read aggregator results numerically instead of checking for object (sketch) output; API changes in Druid versions that route through getFloat for double results.

Related errors


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