{"record":{"id":"9bbb0d103a9bbb1f","repo":"apache/druid","slug":"could-not-ingest-value-s-as-double-for-dimensio","errorCode":null,"errorMessage":"Could not ingest value [%s] as double for dimension [%s]. A double column cannot have multiple values in the same row.","messagePattern":"Could not ingest value \\[(.+?)\\] as double for dimension \\[(.+?)\\]\\. A double column cannot have multiple values in the same row\\.","errorType":"validation","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java","lineNumber":743,"sourceCode":"        throw new ParseException((String) valObj, message);\n      }\n      return ret;\n    } else if (valObj instanceof List) {\n      final String message;\n      if (fieldName != null) {\n        message = StringUtils.nonStrictFormat(\n            \"Could not ingest value [%s] as double for dimension [%s]. A double column cannot have multiple values in the same row.\",\n            valObj,\n            fieldName\n        );\n      } else {\n        message = StringUtils.nonStrictFormat(\n            \"Could not ingest value [%s] as double. A double column cannot have multiple values in the same row.\",\n            valObj\n        );\n      }\n\n      throw new ParseException(\n          valObj.getClass().toString(),\n          message\n      );\n    } else {\n      final String message;\n      if (fieldName != null) {\n        message = StringUtils.nonStrictFormat(\n            \"Could not convert value [%s] to double for dimension [%s]. Invalid type: [%s]\",\n            valObj,\n            fieldName,\n            valObj.getClass()\n        );\n      } else {\n        message = StringUtils.nonStrictFormat(\n            \"Could not convert value [%s] to double. Invalid type: [%s]\",\n            valObj, valObj.getClass()\n        );\n      }","sourceCodeStart":725,"sourceCodeEnd":761,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java#L725-L761","documentation":"convertObjectToDouble throws this ParseException when the value is a List: double columns are single-valued, so multi-value inputs cannot be converted. Numeric columns in Druid reject multi-value rows.","triggerScenarios":"A double-typed column receives a JSON array (e.g. [1.0, 2.0]); the List branch of convertObjectToDouble throws; also reached via convertObjectToType dispatch.","commonSituations":"Array-typed sensor readings mapped to a metric column; occasional multi-valued rows from JSON/Kafka feeds; schema drift introducing arrays where scalars were expected.","solutions":["Flatten/unnest arrays before ingestion or take a single element via transform.","Declare the field as a multi-value string dimension if arrays are legitimate.","Ensure producers emit scalar numbers for metric fields.","Add upstream validation to reject array-valued metrics before ingestion."],"exampleFix":"// before: \"weights\": [70.5, 71.0] for double column weights\n// after: transform averages to a scalar\n\"transforms\": [{\"type\": \"expression\", \"name\": \"weights\", \"expression\": \"CAST(array_avg(weights) AS DOUBLE)\"}]","handlingStrategy":"validation","validationCode":"boolean isScalar(Object v) {\n  return v == null || !(v instanceof List);\n}","typeGuard":"Double firstAsDouble(Object v) {\n  if (v instanceof List) {\n    List<?> l = (List<?>) v;\n    return l.isEmpty() ? null : asDouble(l.get(0));\n  }\n  return asDouble(v);\n}","tryCatchPattern":"try {\n  return DimensionHandlerUtils.convertObjectToDouble(value, fieldName);\n} catch (ParseException e) {\n  if (e.getMessage().contains(\"multiple values\")) {\n    log.warn(\"Multi-valued input for double field [%s]\", fieldName);\n    return null;\n  }\n  throw e;\n}","preventionTips":["Guarantee scalar values for double/metric columns in producers","Unnest arrays with transforms before ingestion","Use multi-value string dimensions for array data","Add producer-side validation to reject array-valued metrics"],"tags":["ingestion","multi-value","type-conversion"],"backgroundTag":"invalid-argument-format","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"}