apache/druid · error · IllegalStateException
Could not transform value for
Error message
Could not transform value for %s reason: %s
What it means
ExpressionTransform.eval evaluates the Druid expression against a row's input bindings and wraps ANY Throwable (syntax error at plan time is separate; here it is evaluation failure) in this ISE naming the transform and the underlying message. It means the transform expression failed while computing a value for this row during ingestion or query-time transforms.
Solutions
- Inspect the nested cause message and fix the expression (guard nulls, validate inputs) in your transforms spec.
- Wrap risky sub-expressions in functions that handle nulls (e.g. NVL, TRY expressions where available) or use 'nullIf' patterns to avoid division by zero.
- Verify referenced columns exist in the input data and check a sample of input records for unexpected values (nulls, empty strings, bad formats).
- Test the expression standalone with Druid's expression evaluation (e.g. via a small ingestion spec or EXPLAIN /表达式 eval in tests) before full ingestion.
Example fix
// before
"transformSpec": { "transforms": [{ "name": "ratio", "expression": "a / b" }] }
// after
"transformSpec": { "transforms": [{ "name": "ratio", "expression": "a / (b + 0.0 == 0 ? null : b)" }] } Defensive patterns
Strategy: try-catch
Validate before calling
// validate expression before submitting ingestion: // use Druid's built-in expression parser/validator or EXPLAIN on a query using the same expression, // and null-guard inputs: expression should tolerate null columns.
Try / catch
try {
Object value = transform.eval(row);
} catch (ISE e) {
log.warn("Transform '{}' failed for row: {}", transform.getName(), e.getMessage(), e.getCause());
metrics.incrementTransformFailures(transform.getName());
return null; // or route row to a rejection path
} Prevention
- Null-guard columns in transform expressions (use coalesce/nvl).
- Avoid division expressions without zero checks.
- Test transforms against a sample of real input data before full ingestion.
- Log the cause chain to identify the exact failing sub-expression.
When it happens
Trigger: Calling ExpressionTransform.eval(row) when the underlying expression evaluation throws — e.g. arithmetic on null/missing columns, division by zero, type errors in functions, or malformed expression logic that only fails for certain row values.
Common situations: Transform expressions referencing missing columns; regex_replace or timestampParse given unexpected row values; divide-by-zero in numeric transforms; NaN/empty string inputs to math functions during ingestion with transforms configured in the ioConfig.
Related errors
- Could not transform dimension value for
- Transform name ' ' cannot be used twice
- Attempt to add row to swapped-out sink for segment
- attempt to get boolean[] null vector from string[] only…
- attempt to get double[] from string[] only scalar binding
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/413d86e337fa6a59.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/segment/transform/ExpressionTransform.java:116
static class ExpressionRowFunction implements RowFunction
{
private final String name;
private final Expr expr;
ExpressionRowFunction(final String name, final Expr expr)
{
this.name = name;
this.expr = expr;
}
@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)
{View on GitHub (pinned to 9b90983fd2)