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

  1. Cast the string input to DOUBLE explicitly in the expression so the proper typed selector/binding is used
  2. Use string-safe functions or numeric parse functions that operate on strings
  3. 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

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


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