apache/druid · error · java.lang.UnsupportedOperationException
Not implemented
Error message
Not implemented
What it means
ArrayOfDoublesSketchBuildAggregator aggregates into an ArrayOfDoublesSketch complex object, so numeric accessors like getLong() (and getFloat()) have no meaningful value to return; they unconditionally throw UnsupportedOperationException. This surfaces if a query or metric extraction asks for the aggregation result as a long/float primitive.
Solutions
- Use get() to obtain the ArrayOfDoublesSketch object instead of getLong()/getFloat()
- Use the tuple-sketch specific post-aggregators (e.g. ArrayOfDoublesSketchTo Estimates/sums) to extract numeric results
- In SQL, wrap with the appropriate tuple sketch functions (e.g. DS_DOUBLES_* estimators) rather than casting the sketch to a number
Example fix
// before long v = aggregator.getLong(); // throws // after ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) aggregator.get(); double estimate = sketch.getEstimate();
Defensive patterns
Strategy: validation
Validate before calling
if (aggregator instanceof ArrayOfDoublesSketchBuildAggregator) {
Object result = ((ArrayOfDoublesSketchBuildAggregator) aggregator).get(); // use get(), never getLong()
} Type guard
boolean yieldsNumeric(ArrayOfDoublesSketchBuildAggregator agg) {
return false; // numeric accessors are unsupported; always use get()
} Try / catch
try {
long v = aggregator.getLong();
} catch (UnsupportedOperationException e) {
ArrayOfDoublesSketch s = (ArrayOfDoublesSketch) aggregator.get();
// extract estimates via tuple sketch post-aggregators
} Prevention
- Never use numeric getters on sketch aggregators; call get()
- Use tuple-sketch specific post-aggregators for numeric results
- In SQL, use DS_DOUBLES_* functions instead of casting sketch columns to numbers
When it happens
Trigger: Querying an ArrayOfDoublesSketch aggregator column with a numeric accessor — e.g. selecting the raw aggregator output in a context that calls getLong()/getFloat(), or configuring a post-aggregator that reads the sketch value as a number instead of using the tuple sketch specific post-aggregators.
Common situations: Using SUM/MIN/MAX or other numeric aggregators directly on the tuple sketch column; selecting the sketch column in SQL where the planner requests a primitive; writing custom code that calls getLong() on the aggregator instead of get() to fetch the sketch object.
Related errors
- Number of metricColumns
- A-Not-B requires at least 1 sketch
- Can't get sketch from object of type
- Cannot translate sqlTypeName
- Cannot translate sqlTypeName
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/118d1804ed902223.
Report an issue: GitHub.
Appendix: source
Thrown at extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchBuildAggregator.java:149
/**
* This method uses synchronization because it can be used during indexing,
* and Druid can call aggregate() and get() concurrently
* https://github.com/apache/druid/pull/3956
* The returned sketch is a separate instance of ArrayOfDoublesCompactSketch
* representing the current state of the aggregation, and is not affected by consequent
* aggregate() calls
*/
@Override
public synchronized Object get()
{
initializeSketchIfNeeded();
return sketch.compact();
}
@Override
public long getLong()
{
throw new UnsupportedOperationException("Not implemented");
}
@Override
public float getFloat()
{
throw new UnsupportedOperationException("Not implemented");
}
@Override
public void close()
{
sketch = null;
values = null;
}
/**
* Initialize {@link #sketch} if it is null.
*/View on GitHub (pinned to 9b90983fd2)