apache/druid · error · ParseException

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

Error message

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

What it means

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.

Source

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

        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 double for dimension [%s]. A double column cannot have multiple values in the same row.",
            valObj,
            fieldName
        );
      } else {
        message = StringUtils.nonStrictFormat(
            "Could not ingest value [%s] as double. A double 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 double for dimension [%s]. Invalid type: [%s]",
            valObj,
            fieldName,
            valObj.getClass()
        );
      } else {
        message = StringUtils.nonStrictFormat(
            "Could not convert value [%s] to double. Invalid type: [%s]",
            valObj, valObj.getClass()
        );
      }

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Flatten/unnest arrays before ingestion or take a single element via transform.
  2. Declare the field as a multi-value string dimension if arrays are legitimate.
  3. Ensure producers emit scalar numbers for metric fields.
  4. Add upstream validation to reject array-valued metrics before ingestion.

Example fix

// before: "weights": [70.5, 71.0] for double column weights
// after: transform averages to a scalar
"transforms": [{"type": "expression", "name": "weights", "expression": "CAST(array_avg(weights) AS DOUBLE)"}]
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

Double firstAsDouble(Object v) {
  if (v instanceof List) {
    List<?> l = (List<?>) v;
    return l.isEmpty() ? null : asDouble(l.get(0));
  }
  return asDouble(v);
}

Try / catch

try {
  return DimensionHandlerUtils.convertObjectToDouble(value, fieldName);
} catch (ParseException e) {
  if (e.getMessage().contains("multiple values")) {
    log.warn("Multi-valued input for double field [%s]", fieldName);
    return null;
  }
  throw e;
}

Prevention

When it happens

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

Common situations: 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.

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/9bbb0d103a9bbb1f. Report an issue: GitHub.