apache/druid · error · IllegalArgumentException
Expected a string with a number, received value
Error message
Expected a string with a number, received value
What it means
TDigestSketchComplexMetricSerde.extractValue accepts raw values that are null, Number, or MergingDigest, and strings only if they look like a number (start with a digit) or decode as a base64-encoded MergingDigest (which always starts with 'A'). The error fires when a string value matches neither shape, meaning the row column contains arbitrary text that cannot be interpreted as sketch input.
Solutions
- Ensure the input column contains numeric values or base64-encoded MergingDigest strings
- Fix the ingestion spec (parseSpec/flattener) so the field is parsed as a number or sketch, not raw text
- Preprocess or filter out rows whose sketch column holds non-numeric, non-base64 strings
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at extensions-contrib/tdigestsketch/src/main/java/org/apache/druid/query/aggregation/tdigestsketch/TDigestSketchComplexMetricSerde.java:67 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/893ef632cb9f020b.
Report an issue: GitHub.
Appendix: source
Thrown at extensions-contrib/tdigestsketch/src/main/java/org/apache/druid/query/aggregation/tdigestsketch/TDigestSketchComplexMetricSerde.java:67
@Override
public Object extractValue(final InputRow inputRow, final String metricName)
{
final Object object = inputRow.getRaw(metricName);
if (object == null || object instanceof Number || object instanceof MergingDigest) {
return object;
}
if (object instanceof String) {
String objectString = (String) object;
if (Character.isDigit((objectString).charAt(0))) {
// Base64 representation of MergingDigest starts with A. So if it's a
// string that starts with a digit, we assume it is a number.
try {
Double doubleValue = Double.parseDouble(objectString);
return doubleValue;
}
catch (NumberFormatException e) {
throw new IAE("Expected a string with a number, received value " + objectString);
}
}
}
return TDigestSketchUtils.deserialize(object);
}
};
}
@Override
public ObjectStrategy<MergingDigest> getObjectStrategy()
{
return STRATEGY;
}
}
View on GitHub (pinned to 9b90983fd2)