{"record":{"id":"226e5fb195a1e44f","repo":"apache/druid","slug":"could-not-transform-dimension-value-for-s-reason","errorCode":null,"errorMessage":"Could not transform dimension value for %s reason: %s","messagePattern":"Could not transform dimension value for (.+?) reason: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/segment/transform/ExpressionTransform.java","lineNumber":127,"sourceCode":"    @Override\n    public Object eval(final Row row)\n    {\n      try {\n        return expr.eval(InputBindings.forRow(row)).value();\n      }\n      catch (Throwable t) {\n        throw new ISE(t, \"Could not transform value for %s reason: %s\", name, t.getMessage());\n      }\n    }\n\n    @Override\n    public List<String> evalDimension(Row row)\n    {\n      try {\n        return Rows.objectToStrings(expr.eval(InputBindings.forRow(row)).value());\n      }\n      catch (Throwable t) {\n        throw new ISE(t, \"Could not transform dimension value for %s reason: %s\", name, t.getMessage());\n      }\n    }\n  }\n\n  @Override\n  public boolean equals(final Object o)\n  {\n    if (this == o) {\n      return true;\n    }\n    if (o == null || getClass() != o.getClass()) {\n      return false;\n    }\n    final ExpressionTransform that = (ExpressionTransform) o;\n    return Objects.equals(name, that.name) &&\n           Objects.equals(expression, that.expression);\n  }\n","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/transform/ExpressionTransform.java#L109-L145","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Read the wrapped cause message and adjust the expression to handle the failing input values (null guards, format validation).","Ensure the expression returns a scalar or list of scalars convertible to strings; avoid returning maps/objects for dimension transforms.","Validate input data columns exist and sample rows conform to expected types before ingestion.","Use Druid's expression documentation to confirm each function's null and type behavior for your inputs."],"exampleFix":"// before\n\"expression\": \"concat(prefix, '-', timestamp_parse(ts, null, 'UTC'))\"\n// after\n\"expression\": \"concat(prefix, '-', coalesce(cast(timestamp_parse(ts, null, 'UTC') as string), 'unknown'))\"","handlingStrategy":"try-catch","validationCode":"// ensure the transform's expression returns scalar (or list of scalar) values before using it as a dimension:\n// dry-run the ingestion spec on a small sample or validate via Druid expression parsing tooling.","typeGuard":null,"tryCatchPattern":"try {\n    List<String> dims = transform.evalDimension(row);\n} catch (ISE e) {\n    log.warn(\"Dimension transform '{}' failed: {}\", transform.getName(), e.getCause());\n    return Collections.emptyList();\n}","preventionTips":["Keep dimension transforms returning simple scalar/list values, not nested objects.","Handle null and malformed input strings in expressions.","Validate expression functions against your Druid version's supported function list."],"tags":["druid","ingestion","expression","transform","dimension"],"backgroundTag":"expression-evaluation-failed","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}