apache/druid · error · java.lang.UnsupportedOperationException
attempt to get double[] from string[] only scalar binding
Error message
attempt to get double[] from string[] only scalar binding
What it means
Same string-only binding limitation, for double[]: the deferred-evaluation vector bindings for a single string input cannot produce double vectors, so getDoubleVector throws UnsupportedOperationException by design rather than returning wrong data.
Source
Thrown at processing/src/main/java/org/apache/druid/segment/virtual/SingleStringInputDeferredEvaluationExpressionDimensionVectorSelector.java:164
return -1;
}
@Override
public Object[] getObjectVector(String name)
{
return currentValue;
}
@Override
public long[] getLongVector(String name)
{
throw new UnsupportedOperationException("attempt to get long[] from string[] only scalar binding");
}
@Override
public double[] getDoubleVector(String name)
{
throw new UnsupportedOperationException("attempt to get double[] from string[] only scalar binding");
}
@Nullable
@Override
public boolean[] getNullVector(String name)
{
throw new UnsupportedOperationException("attempt to get boolean[] null vector from string[] only scalar binding");
}
}
}
View on GitHub (pinned to 9b90983fd2)
Solutions
- Cast the string input to DOUBLE explicitly in the expression so the proper typed selector/binding is used
- Use string-safe functions or numeric parse functions that operate on strings
- Disable vectorization if the expression typing cannot be adjusted
Example fix
// before double_func(string_col) // after CAST(string_col AS DOUBLE) -- then apply double_func
Defensive patterns
Strategy: try-catch
Validate before calling
// ensure expression only uses string-compatible functions over the string input binding
Expr.InputBindingTypes t = expr.analyzeInputs();
if (!t.getRequiredBindings().isEmpty() && !isStringTyped(expr)) { /* replan */ } Try / catch
try {
return bindings.getDoubleVector(name);
} catch (UnsupportedOperationException e) {
return evalAsDouble(bindings.getStringVector(name)); // or disable vectorization
} Prevention
- CAST strings to DOUBLE before double arithmetic in vectorized expressions
- Keep single-input deferred selectors paired with string-typed expressions
- Cover vectorized type-mixing queries in regression tests
When it happens
Trigger: Expression evaluation requests getDoubleVector(name) from the single-string-input binding, typically when an expression over a string column is vector-typed as double[].
Common situations: Expressions applying double math directly to string inputs under vectorization; planner typing mismatches after expression changes.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- attempt to get long[] from string[] only scalar binding
- attempt to get boolean[] null vector from string[] only scal
- unsupported type
- Selector must have a dictionary
- Selector of class[%s] does not have a dictionary, cannot use
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/35a712238fdb0b74.
Report an issue: GitHub.