apache/druid · error · java.lang.UnsupportedOperationException
CardinalityBufferAggregators does not support getDouble()
Error message
CardinalityBufferAggregators does not support getDouble()
What it means
CardinalityBufferAggregator's getDouble() is unsupported: the buffer holds an HLL sketch, not a double, so the method always throws UnsupportedOperationException. (The message contains a pre-existing typo: 'CardinalityBufferAggregators'.)
Source
Thrown at processing/src/main/java/org/apache/druid/query/aggregation/cardinality/CardinalityBufferAggregator.java:98
}
@Override
public float getFloat(ByteBuffer buf, int position)
{
throw new UnsupportedOperationException("CardinalityBufferAggregator does not support getFloat()");
}
@Override
public long getLong(ByteBuffer buf, int position)
{
throw new UnsupportedOperationException("CardinalityBufferAggregator does not support getLong()");
}
@Override
public double getDouble(ByteBuffer buf, int position)
{
throw new UnsupportedOperationException("CardinalityBufferAggregators does not support getDouble()");
}
@Override
public void close()
{
// no resources to cleanup
}
@Override
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
{
for (int i = 0; i < selectorPluses.length; i++) {
inspector.visit(StringUtils.format("selector-%d", i), selectorPluses[i].getSelector());
}
}
}
View on GitHub (pinned to 9b90983fd2)
Solutions
- Read the sketch via get(buf, position) instead of getDouble()
- Use a numeric aggregator if a double result is required
- Finalize the sketch into an estimate before numeric consumption
Example fix
// before double v = bufferAggregator.getDouble(buf, position); // after Object v = bufferAggregator.get(buf, position); // HLL sketch
Defensive patterns
Strategy: type-guard
Validate before calling
if (!(aggFactory instanceof CardinalityAggregatorFactory)) { double v = bufferAggregator.getDouble(buf, position); } Type guard
if (factory instanceof CardinalityAggregatorFactory) {
Object v = bufferAggregator.get(buf, position);
} else {
double v = bufferAggregator.getDouble(buf, position);
} Try / catch
try {
v = bufferAggregator.getDouble(buf, position);
} catch (UnsupportedOperationException e) {
v = Double.NaN;
} Prevention
- Use double aggregators for double-typed columns
- Never call getDouble on sketch-based buffer aggregators
- Keep result extraction generic via get() when aggregation type is unknown
When it happens
Trigger: Calling bufferAggregator.getDouble(buf, position) on a cardinality buffer aggregator when a double-typed result is assumed.
Common situations: Vectorized double extraction on cardinality aggregations; generic aggregation pipelines that request double values from all aggregators.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- CardinalityAggregator does not support getFloat()
- CardinalityAggregator does not support getLong()
- CardinalityAggregator does not support getDouble()
- CardinalityBufferAggregator does not support getFloat()
- CardinalityBufferAggregator does not support getLong()
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/d027d538c4cb42ed.
Report an issue: GitHub.