{"record":{"id":"975e4155f45b6757","repo":"apache/druid","slug":"could-not-ingest-value-s-as-float-for-dimension","errorCode":null,"errorMessage":"Could not ingest value [%s] as float for dimension [%s]. A float column cannot have multiple values in the same row.","messagePattern":"Could not ingest value \\[(.+?)\\] as float for dimension \\[(.+?)\\]\\. A float 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":531,"sourceCode":"          }\n          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 float for dimension [%s]. A float 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 float. A float column cannot have multiple values in the same row.\",\n              valObj\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 float 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 float. Invalid type: [%s]\",\n              valObj,\n              valObj.getClass()\n          );","sourceCodeStart":513,"sourceCodeEnd":549,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java#L513-L549","documentation":"convertObjectToFloat throws this ParseException when the value is a List: float columns are single-valued and multi-value inputs cannot be converted. Same restriction as for long columns but for float.","triggerScenarios":"A float-typed column receives a JSON array (e.g. [1.5, 2.5]) so the List branch of convertObjectToFloat throws; also reached via convertObjectToType.","commonSituations":"Metrics arriving as arrays from upstream sensors/events; schema drift where a field occasionally becomes multi-valued; JSON input with inconsistent nesting.","solutions":["Unnest/flatten the array before ingestion or take a single representative element.","Declare the field as a multi-value string dimension instead of float if multi-valued data is legitimate.","Transform: use the first element expression to guarantee scalar input.","Reject/drop such rows upstream with input validation before ingestion."],"exampleFix":"// before: \"temps\": [20.1, 21.3] for float column temps\n// after: transform takes first value\n\"transforms\": [{\"type\": \"expression\", \"name\": \"temps\", \"expression\": \"CAST(temps[0] AS DOUBLE)\"}]","handlingStrategy":"validation","validationCode":"boolean isScalar(Object v) {\n  return v == null || !(v instanceof List);\n}","typeGuard":"Float firstAsFloat(Object v) {\n  if (v instanceof List) {\n    List<?> l = (List<?>) v;\n    return l.isEmpty() ? null : asFloat(l.get(0));\n  }\n  return asFloat(v);\n}","tryCatchPattern":"try {\n  return DimensionHandlerUtils.convertObjectToFloat(value, fieldName);\n} catch (ParseException e) {\n  if (e.getMessage().contains(\"multiple values\")) {\n    return firstAsFloat(value); // or drop row\n  }\n  throw e;\n}","preventionTips":["Unnest arrays before mapping to float columns","Use multi-value string dimensions for legitimately multi-valued data","Enforce scalar-only metric fields in producer validation","Monitor for schema drift in JSON/Kafka feeds"],"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"}