apache/druid · error · IllegalStateException

Could not transform dimension value for

Error message

Could not transform dimension value for %s reason: %s

What it means

ExpressionTransform.evalDimension evaluates the transform expression and converts the result to a list of dimension strings via Rows.objectToStrings; any Throwable during evaluation or conversion is wrapped in this ISE naming the transform and cause. It is the dimension-valued counterpart of the generic eval failure.

Solutions

  1. Read the wrapped cause message and adjust the expression to handle the failing input values (null guards, format validation).
  2. Ensure the expression returns a scalar or list of scalars convertible to strings; avoid returning maps/objects for dimension transforms.
  3. Validate input data columns exist and sample rows conform to expected types before ingestion.
  4. Use Druid's expression documentation to confirm each function's null and type behavior for your inputs.

Example fix

// before
"expression": "concat(prefix, '-', timestamp_parse(ts, null, 'UTC'))"
// after
"expression": "concat(prefix, '-', coalesce(cast(timestamp_parse(ts, null, 'UTC') as string), 'unknown'))"
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure the transform's expression returns scalar (or list of scalar) values before using it as a dimension:
// dry-run the ingestion spec on a small sample or validate via Druid expression parsing tooling.

Try / catch

try {
    List<String> dims = transform.evalDimension(row);
} catch (ISE e) {
    log.warn("Dimension transform '{}' failed: {}", transform.getName(), e.getCause());
    return Collections.emptyList();
}

Prevention

When it happens

Trigger: Calling ExpressionTransform.evalDimension(row) when the expression evaluation or objectToStrings conversion throws for a given row — e.g. expression producing a type Rows.objectToStrings cannot handle, or runtime failure on specific row values (null math, bad function input).

Common situations: Transforms used as dimensions in ingestion where expressions return complex/nested objects; expressions hitting null/missing columns; regex or date-parse functions failing on unexpected string values in the input data.

Related errors


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

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/segment/transform/ExpressionTransform.java:127

    @Override
    public Object eval(final Row row)
    {
      try {
        return expr.eval(InputBindings.forRow(row)).value();
      }
      catch (Throwable t) {
        throw new ISE(t, "Could not transform value for %s reason: %s", name, t.getMessage());
      }
    }

    @Override
    public List<String> evalDimension(Row row)
    {
      try {
        return Rows.objectToStrings(expr.eval(InputBindings.forRow(row)).value());
      }
      catch (Throwable t) {
        throw new ISE(t, "Could not transform dimension value for %s reason: %s", name, t.getMessage());
      }
    }
  }

  @Override
  public boolean equals(final Object o)
  {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    final ExpressionTransform that = (ExpressionTransform) o;
    return Objects.equals(name, that.name) &&
           Objects.equals(expression, that.expression);
  }

View on GitHub (pinned to 9b90983fd2)