{"record":{"id":"b646f134ac902ab2","repo":"apache/druid","slug":"parameter-fieldname-must-be-specified-b646f1","errorCode":null,"errorMessage":"Parameter fieldName must be specified","messagePattern":"Parameter fieldName must be specified","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":500,"severity":"error","filePath":"extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchAggregatorFactory.java","lineNumber":122,"sourceCode":"  {\n    this(name, fieldName, k, null, DEFAULT_SHOULD_FINALIZE);\n  }\n\n  DoublesSketchAggregatorFactory(\n      final String name,\n      final String fieldName,\n      @Nullable final Integer k,\n      @Nullable final Long maxStreamLength,\n      @Nullable final Boolean shouldFinalize,\n      final byte cacheTypeId\n  )\n  {\n    if (name == null) {\n      throw new IAE(\"Must have a valid, non-null aggregator name\");\n    }\n    this.name = name;\n    if (fieldName == null) {\n      throw new IAE(\"Parameter fieldName must be specified\");\n    }\n    this.fieldName = fieldName;\n    this.k = k == null ? DEFAULT_K : k;\n    Util.checkIfIntPowerOf2(this.k, \"k\");\n    this.maxStreamLength = maxStreamLength == null ? DEFAULT_MAX_STREAM_LENGTH : maxStreamLength;\n    this.shouldFinalize = shouldFinalize == null ? DEFAULT_SHOULD_FINALIZE : shouldFinalize;\n    this.cacheTypeId = cacheTypeId;\n  }\n\n  @Override\n  public Aggregator factorize(final ColumnSelectorFactory metricFactory)\n  {\n    if (metricFactory.getColumnCapabilities(fieldName) != null\n        && metricFactory.getColumnCapabilities(fieldName).isNumeric()) {\n      final ColumnValueSelector<Double> selector = metricFactory.makeColumnValueSelector(fieldName);\n      if (selector instanceof NilColumnValueSelector) {\n        return new NoopDoublesSketchAggregator();\n      }","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchAggregatorFactory.java#L104-L140","documentation":"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.","triggerScenarios":"Constructing DoublesSketchAggregatorFactory with fieldName == null, e.g. a JSON aggregation spec missing \"fieldName\" or referencing a null field after programmatic assembly.","commonSituations":"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.","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"],"exampleFix":"// before\n{\"type\":\"quantilesDoublesSketch\",\"name\":\"sketch_agg\",\"k\":128}\n// after\n{\"type\":\"quantilesDoublesSketch\",\"name\":\"sketch_agg\",\"fieldName\":\"value\",\"k\":128}","handlingStrategy":"validation","validationCode":"if (aggregationSpec.get(\"fieldName\") == null) {\n  throw new IllegalArgumentException(\"quantilesDoublesSketch aggregation requires a 'fieldName' input column\");\n}","typeGuard":"boolean hasFieldName(Map<String,Object> agg) { return agg.get(\"fieldName\") instanceof String && !((String) agg.get(\"fieldName\")).isEmpty(); }","tryCatchPattern":null,"preventionTips":["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"],"tags":["java","druid","aggregation","null-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}