apache/druid · error · java.lang.UnsupportedOperationException
attempt to get long[] from string[] only scalar binding
Error message
attempt to get long[] from string[] only scalar binding
What it means
The StringLookupVectorInputBindings inside SingleStringInputDeferredEvaluationExpressionDimensionVectorSelector only supplies the string value of the single input; array-typed accessors like getLongVector are unsupported because the binding is a string-only scalar/array-of-string source. An expression attempting long[] vector input triggers UnsupportedOperationException.
Source
Thrown at processing/src/main/java/org/apache/druid/segment/virtual/SingleStringInputDeferredEvaluationExpressionDimensionVectorSelector.java:158
return 1;
}
@Override
public int getCurrentVectorId()
{
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
- Ensure the expression's input type matches the string binding (use string-compatible functions)
- Cast the input explicitly in the expression (e.g. parse/CAST to long) so planners use the right selector
- Disable vectorization for the query as a workaround
- Check the expression's analyzeInputs() types against the string-only binding
Example fix
// before long_expr(string_col) + 1 -- expects long[] input // after CAST(string_col AS BIGINT) + 1 -- or use string functions on the binding
Defensive patterns
Strategy: try-catch
Validate before calling
if (expr.analyzeInputs().getRequiredBindings().stream().anyMatch(b -> b.getType() != ExpressionType.STRING)) {
// re-plan with explicit CAST or non-vector engine
} Try / catch
try {
result = evalVectorExpression(expr, bindings);
} catch (UnsupportedOperationException e) {
if (e.getMessage().contains("string[] only scalar binding")) {
result = evalNonVector(expr);
} else throw e;
} Prevention
- Match expression input types to the string binding with explicit CASTs
- Avoid vectorized expressions that expect long[]/double[] inputs on string columns
- Test vectorization on queries with mixed-type expressions
When it happens
Trigger: An expression evaluated through this binding calls getLongVector(name) — e.g. an expression over the string column that the vector engine typed as a long[] input, or a misplanned multi-value input.
Common situations: Vectorized expressions mixing types (long-typed function applied to a string input binding), engine bugs in expression input typing, or custom expressions assuming array-of-long inputs.
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 double[] 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/f39a822e9ca7ee96.
Report an issue: GitHub.