apache/druid · error · UnsupportedOperationException
StringAnyBufferAggregator does not support getFloat()
Error message
StringAnyBufferAggregator does not support getFloat()
What it means
StringAnyBufferAggregator aggregates string values, so its buffer only holds the resulting string; numeric accessors are meaningless and unsupported. Calling getFloat() throws UnsupportedOperationException by design.
Solutions
- Do not call getFloat() on a string any-aggregator; read the result as an Object/String via get()
- If a numeric result is needed, use a numeric aggregator (e.g. doubleSum/longSum) instead of 'any'
- Cast/parse the aggregated string downstream in a post-aggregator if numeric semantics are required
Example fix
// before float v = bufferAggregator.getFloat(buf, position); // after Object v = bufferAggregator.get(buf, position); // string result
Defensive patterns
Strategy: type-guard
Validate before calling
if (aggFactory instanceof StringAnyAggregatorFactory) { /* handle as string, never call getFloat */ } Type guard
if (!(factory instanceof StringAnyAggregatorFactory)) {
float v = bufferAggregator.getFloat(buf, position);
} else {
Object v = bufferAggregator.get(buf, position);
} Try / catch
try {
v = bufferAggregator.getFloat(buf, position);
} catch (UnsupportedOperationException e) {
v = Float.NaN; // or fall back to string get()
} Prevention
- Treat 'any' aggregator output as string-typed in all query/result code
- Never route string aggregations through numeric accessor paths
- Check AggregatorFactory.getType() before invoking numeric getters
When it happens
Trigger: A query/aggregation pipeline calls bufferAggregator.getFloat(buf, position) on a StringAnyAggregatorFactory-created aggregator, i.e. the aggregation's output type was resolved as FLOAT instead of STRING.
Common situations: Querying an 'any' aggregator column expecting a numeric result; misconfigured post-aggregator or result-row numeric extraction on a string-typed aggregation.
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/963e0ef1157fcd06.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/query/aggregation/any/StringAnyBufferAggregator.java:109
@Override
public Object get(ByteBuffer buf, int position)
{
ByteBuffer copyBuffer = buf.duplicate();
copyBuffer.position(position);
int stringSizeBytes = copyBuffer.getInt();
if (stringSizeBytes >= 0) {
byte[] valueBytes = new byte[stringSizeBytes];
copyBuffer.get(valueBytes, 0, stringSizeBytes);
return StringUtils.fromUtf8(valueBytes);
} else {
return null;
}
}
@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-opView on GitHub (pinned to 9b90983fd2)