apache/druid · error · UnsupportedOperationException
StringAnyAggregator does not support getDouble()
Error message
StringAnyAggregator does not support getDouble()
What it means
StringAnyAggregator's getDouble() throws UnsupportedOperationException with this message; the aggregator holds a string value and refuses to present it as a double. Typed accessors on this class exist solely to fail fast on type misuse instead of producing misleading numeric results.
Solutions
- Use getString() and a CastPostAggregator to DOUBLE before any numeric post-aggregation
- Aggregate the underlying numeric column with doubleAny or another numeric aggregator instead of the string column
- Update result-consuming code to check the aggregator's type (string vs numeric) before choosing an accessor
- Re-model the datasource so numeric data is stored with a numeric type
Example fix
// before
row.getDouble("stringAnyMetric")
// after
String s = row.getString("stringAnyMetric");
double d = s == null ? Double.NaN : Double.parseDouble(s); // or CastPostAggregator to DOUBLE Defensive patterns
Strategy: type-guard
Validate before calling
if (aggregator instanceof StringAnyAggregator) {
throw new ISE("stringAny metric cannot be read as double");
} Type guard
boolean supportsDouble(Aggregator a) { return !(a instanceof StringAnyAggregator); } Try / catch
try {
double d = aggregator.getDouble();
} catch (UnsupportedOperationException e) {
String s = aggregator.getString();
double d = s == null ? Double.NaN : Double.parseDouble(s);
} Prevention
- Use getString() for stringAny results; reserve getDouble() for numeric aggregators
- Add CastPostAggregator (to DOUBLE) between string metrics and numeric post-aggregators
- Store numeric data with numeric column types to avoid string aggregation paths
- Tools iterating all aggregators must check types before calling typed getters
When it happens
Trigger: Calling getDouble() on a stringAny aggregator's result — e.g. a doubleSum/arithmetic post-aggregator, an expression referencing the metric numerically, or generic result-row code that assumes double-typed metrics.
Common situations: Native queries with numeric post-aggregators bound to stringAny metrics; dashboards/tools that iterate aggregators and call getDouble() unconditionally; SQL plans where a VARCHAR any-aggregation is consumed by numeric functions.
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
- StringAnyAggregator does not support getFloat()
- StringAnyAggregator does not support getLong()
- Aggregator[ ] cannot vectorize
- ApproximateHistogramBufferAggregator does not support…
- ApproximateHistogramBufferAggregator does not support…
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/18aa29dc6519fdc9.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/query/aggregation/any/StringAnyAggregator.java:98
return foundValue;
}
@Override
public float getFloat()
{
throw new UnsupportedOperationException("StringAnyAggregator does not support getFloat()");
}
@Override
public long getLong()
{
throw new UnsupportedOperationException("StringAnyAggregator does not support getLong()");
}
@Override
public double getDouble()
{
throw new UnsupportedOperationException("StringAnyAggregator does not support getDouble()");
}
@Override
public void close()
{
// no-op
}
}
View on GitHub (pinned to 9b90983fd2)