apache/druid · error · IllegalArgumentException
Parameter fieldName must be specified
Error message
Parameter fieldName must be specified
What it means
DoublesSketchAggregatorFactory requires a non-null fieldName identifying the input column that holds the doubles to sketch. If fieldName is null the factory throws IllegalArgumentException at construction, because the aggregator would have nothing to aggregate over.
Source
Thrown at extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchAggregatorFactory.java:122
{
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()) {
final ColumnValueSelector<Double> selector = metricFactory.makeColumnValueSelector(fieldName);
if (selector instanceof NilColumnValueSelector) {
return new NoopDoublesSketchAggregator();
}View on GitHub (pinned to 9b90983fd2)
Solutions
- Add a valid "fieldName" pointing to an existing numeric input column in the query JSON
- Verify the input column exists in the segment schema and is a numeric type
- In Java code, pass the input column name as the second constructor argument
Example fix
// before
{"type":"quantilesDoublesSketch","name":"sketch_agg","k":128}
// after
{"type":"quantilesDoublesSketch","name":"sketch_agg","fieldName":"value","k":128} Defensive patterns
Strategy: validation
Validate before calling
if (aggregationSpec.get("fieldName") == null) {
throw new IllegalArgumentException("quantilesDoublesSketch aggregation requires a 'fieldName' input column");
} Type guard
boolean hasFieldName(Map<String,Object> agg) { return agg.get("fieldName") instanceof String && !((String) agg.get("fieldName")).isEmpty(); } Prevention
- Check the input column exists and is numeric in the segment schema
- Keep fieldName in sync when renaming columns in ingestion specs
- Validate generated query JSON before submission
When it happens
Trigger: Constructing DoublesSketchAggregatorFactory with fieldName == null, e.g. a JSON aggregation spec missing "fieldName" or referencing a null field after programmatic assembly.
Common situations: Hand-written native queries missing "fieldName"; ingesting/rolling-up specs where the input column was renamed; copying an aggregator spec and accidentally dropping the field key.
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
- Must have a valid, non-null aggregator name
- 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/b646f134ac902ab2.
Report an issue: GitHub.