apache/druid · error · ParseException

Could not ingest value [%s] as float for dimension [%s]. A f

Error message

Could not ingest value [%s] as float for dimension [%s]. A float column cannot have multiple values in the same row.

What it means

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.

Source

Thrown at processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java:531

          }
          throw new ParseException((String) valObj, message);
        }
        return ret;
      } else if (valObj instanceof List) {
        final String message;
        if (fieldName != null) {
          message = StringUtils.nonStrictFormat(
              "Could not ingest value [%s] as float for dimension [%s]. A float column cannot have multiple values in the same row.",
              valObj,
              fieldName
          );
        } else {
          message = StringUtils.nonStrictFormat(
              "Could not ingest value [%s] as float. A float column cannot have multiple values in the same row.",
              valObj
          );
        }
        throw new ParseException(
            valObj.getClass().toString(),
            message
        );
      } else {
        final String message;
        if (fieldName != null) {
          message = StringUtils.nonStrictFormat(
              "Could not convert value [%s] to float for dimension [%s]. Invalid type: [%s]",
              valObj,
              fieldName,
              valObj.getClass()
          );
        } else {
          message = StringUtils.nonStrictFormat(
              "Could not convert value [%s] to float. Invalid type: [%s]",
              valObj,
              valObj.getClass()
          );

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Unnest/flatten the array before ingestion or take a single representative element.
  2. Declare the field as a multi-value string dimension instead of float if multi-valued data is legitimate.
  3. Transform: use the first element expression to guarantee scalar input.
  4. Reject/drop such rows upstream with input validation before ingestion.

Example fix

// before: "temps": [20.1, 21.3] for float column temps
// after: transform takes first value
"transforms": [{"type": "expression", "name": "temps", "expression": "CAST(temps[0] AS DOUBLE)"}]
Defensive patterns

Strategy: validation

Validate before calling

boolean isScalar(Object v) {
  return v == null || !(v instanceof List);
}

Type guard

Float firstAsFloat(Object v) {
  if (v instanceof List) {
    List<?> l = (List<?>) v;
    return l.isEmpty() ? null : asFloat(l.get(0));
  }
  return asFloat(v);
}

Try / catch

try {
  return DimensionHandlerUtils.convertObjectToFloat(value, fieldName);
} catch (ParseException e) {
  if (e.getMessage().contains("multiple values")) {
    return firstAsFloat(value); // or drop row
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Metrics arriving as arrays from upstream sensors/events; schema drift where a field occasionally becomes multi-valued; JSON input with inconsistent nesting.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/975e4155f45b6757. Report an issue: GitHub.