apache/druid · error · java.lang.UnsupportedOperationException
StringAnyBufferAggregator does not support getDouble()
Error message
StringAnyBufferAggregator does not support getDouble()
What it means
Same unsupported-accessor guard as getLong: StringAnyBufferAggregator.getDouble() always throws UnsupportedOperationException because the aggregate value is a UTF-8 string that cannot be read as a double from the buffer. Fires when the query asks for double-typed access on a string ANY aggregate.
Solutions
- Cast/parse the resulting string explicitly after aggregation instead of using getDouble().
- Aggregate a numeric column directly if a double result is required.
- Verify the output type in the query plan matches VARCHAR for the ANY aggregator.
Example fix
// before double v = bufferAggregator.getDouble(buf, position); // after Object v = bufferAggregator.get(buf, position); // string result
Defensive patterns
Strategy: validation
Validate before calling
if (aggFactory instanceof StringAnyAggregatorFactory) { /* read via get(), not getDouble */ } Type guard
if (factory instanceof StringAnyAggregatorFactory) {
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; // or fall back to string get()
} Prevention
- Use a double aggregator when double output is needed
- Branch on factory type before numeric access
- Parse string results explicitly when numeric values are required
When it happens
Trigger: Calling bufferAggregator.getDouble(buf, position) on a StringAnyAggregatorFactory-created aggregator when numeric output is assumed.
Common situations: Treating a string any-aggregation as numeric in query post-processing; swapping an aggregator type without updating numeric accessors in custom code.
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 getDouble()
- CardinalityAggregator does not support getFloat()
- CardinalityAggregator does not support getLong()
- 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/31c509a76e6a326a.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/query/aggregation/any/StringAnyBufferAggregator.java:121
}
}
@Override
public float getFloat(ByteBuffer buf, int position)
{
throw new UnsupportedOperationException("StringAnyBufferAggregator does not support getFloat()");
}
@Override
public long getLong(ByteBuffer buf, int position)
{
throw new UnsupportedOperationException("StringAnyBufferAggregator does not support getLong()");
}
@Override
public double getDouble(ByteBuffer buf, int position)
{
throw new UnsupportedOperationException("StringAnyBufferAggregator does not support getDouble()");
}
@Override
public void close()
{
// no-op
}
}
View on GitHub (pinned to 9b90983fd2)