apache/druid · error · IllegalArgumentException
Must have a valid, non-null aggregator name
Error message
Must have a valid, non-null aggregator name
What it means
DoublesSketchAggregatorFactory (Apache Druid datasketches quantiles extension) validates its constructor arguments eagerly. The aggregator 'name' (the output column name) is required and cannot be null; the factory throws IllegalArgumentException immediately rather than failing later at query time. This guarantees every aggregator in a query spec has an addressable output name.
Source
Thrown at extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchAggregatorFactory.java:118
final String name,
final String fieldName,
@Nullable final Integer k
)
{
this(name, fieldName, k, null, DEFAULT_SHOULD_FINALIZE);
}
DoublesSketchAggregatorFactory(
final String name,
final String fieldName,
@Nullable final Integer k,
@Nullable final Long maxStreamLength,
@Nullable final Boolean shouldFinalize,
final byte cacheTypeId
)
{
if (name == null) {
throw new IAE("Must have a valid, non-null aggregator name");
}
this.name = name;
if (fieldName == null) {
throw new IAE("Parameter fieldName must be specified");
}
this.fieldName = fieldName;
this.k = k == null ? DEFAULT_K : k;
Util.checkIfIntPowerOf2(this.k, "k");
this.maxStreamLength = maxStreamLength == null ? DEFAULT_MAX_STREAM_LENGTH : maxStreamLength;
this.shouldFinalize = shouldFinalize == null ? DEFAULT_SHOULD_FINALIZE : shouldFinalize;
this.cacheTypeId = cacheTypeId;
}
@Override
public Aggregator factorize(final ColumnSelectorFactory metricFactory)
{
if (metricFactory.getColumnCapabilities(fieldName) != null
&& metricFactory.getColumnCapabilities(fieldName).isNumeric()) {View on GitHub (pinned to 9b90983fd2)
Solutions
- Add a non-null "name" field to the aggregation spec in the query JSON
- In code, pass a valid output name string as the first constructor argument
- If building from SQL, check that the planner-assigned aggregator name is not being overwritten with null
Example fix
// before
{"type":"quantilesDoublesSketch","fieldName":"value","k":128}
// after
{"type":"quantilesDoublesSketch","name":"sketch_agg","fieldName":"value","k":128} Defensive patterns
Strategy: validation
Validate before calling
if (aggregationSpec.get("name") == null || aggregationSpec.get("name").toString().isEmpty()) {
throw new IllegalArgumentException("quantilesDoublesSketch aggregation requires a non-null 'name'");
} Type guard
boolean hasName(Map<String,Object> agg) { return agg.get("name") instanceof String && !((String) agg.get("name")).isEmpty(); } Prevention
- Always include "name" in every aggregation spec
- Validate query JSON against Druid's aggregator schema before submitting
- When building aggregators in Java, pass literal non-null name strings
When it happens
Trigger: Constructing a DoublesSketchAggregatorFactory with a null name via JSON (e.g. an aggregation entry missing the "name" field or set to null) or programmatically via the public constructor.
Common situations: Hand-written native JSON queries where the aggregation object omits "name"; SQL planner bugs or extension code building aggregators dynamically; deserializing a saved query spec that was truncated or hand-edited.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Parameter fieldName must be specified
- AggregatorFactoryNotMergeableException(this, other)
- ApproximateHistogramBufferAggregator does not support getFlo
- ApproximateHistogramBufferAggregator does not support getLon
- ApproximateHistogramBufferAggregator does not support getDou
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/3e54204a9b54b53c.
Report an issue: GitHub.