apache/druid · warning · UnsupportedOperationException
Not implemented
Error message
Not implemented
What it means
MomentSketchMergeAggregator.getFloat throws UnsupportedOperationException because merged Moments Sketch results are composite objects that cannot be exposed as a float. The merge aggregator combines sketches; any attempt to read its value as a float triggers this error.
Source
Thrown at extensions-contrib/momentsketch/src/main/java/org/apache/druid/query/aggregation/momentsketch/aggregator/MomentSketchMergeAggregator.java:61
public void aggregate()
{
final MomentSketchWrapper sketch = selector.getObject();
if (sketch == null) {
return;
}
this.momentsSketch.merge(sketch);
}
@Override
public Object get()
{
return momentsSketch;
}
@Override
public float getFloat()
{
throw new UnsupportedOperationException("Not implemented");
}
@Override
public long getLong()
{
throw new UnsupportedOperationException("Not implemented");
}
@Override
public void close()
{
momentsSketch = null;
}
}
View on GitHub (pinned to 9b90983fd2)
Solutions
- Keep the sketch aggregation output as COMPLEX and read merged sketches via getObject.
- Replace float coercion with sketch-specific post-aggregators (quantile, mean).
- Remove any expression or cast that treats the merged sketch column as a float.
- Use MomentSketchAggregatorFactory's merge/finalize APIs rather than numeric accessors.
Example fix
// before
PostAggregator p = (Float) row.get("sketch"); // engine calls getFloat
// after
MomentSketchWrapper sketch = (MomentSketchWrapper) row.get("sketch");
double mean = sketch.mean(); Defensive patterns
Strategy: type-guard
Validate before calling
if ("FLOAT".equals(querySpec.getOutputTypeOf("sketch"))) {
throw new IllegalArgumentException("merged momentsketch requires COMPLEX output");
} Type guard
Object val = row.get("sketch");
if (val instanceof MomentSketchWrapper) {
MomentSketchWrapper sketch = (MomentSketchWrapper) val; // safe, numeric via post-aggregator
} Try / catch
try {
return mergeAggregator.getFloat();
} catch (UnsupportedOperationException e) {
throw new IllegalStateException("Read merged sketch via getObject, not getFloat", e);
} Prevention
- Never request FLOAT output on merged sketch aggregations.
- Derive floats only via sketch post-aggregators.
- Branch on aggregator type in generic tooling before calling numeric getters.
- Read merged rows with getObject and cast to MomentSketchWrapper.
When it happens
Trigger: A query performs sketch merging (e.g. group-by across segments or a final merge stage) and requests the merged metric as FLOAT, causing getFloat() on the merge aggregator.
Common situations: Group-by queries with sketch aggregations coerced to float output; finalization/post-aggregation code calling getFloat on merged rows; query tooling assuming numeric aggregator types.
Related errors
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/14a289e69b2fe131.
Report an issue: GitHub.