{"record":{"id":"35a712238fdb0b74","repo":"apache/druid","slug":"attempt-to-get-double-from-string-only-scalar","errorCode":null,"errorMessage":"attempt to get double[] from string[] only scalar binding","messagePattern":"attempt to get double\\[\\] from string\\[\\] only scalar binding","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/segment/virtual/SingleStringInputDeferredEvaluationExpressionDimensionVectorSelector.java","lineNumber":164,"sourceCode":"      return -1;\n    }\n\n    @Override\n    public Object[] getObjectVector(String name)\n    {\n      return currentValue;\n    }\n\n    @Override\n    public long[] getLongVector(String name)\n    {\n      throw new UnsupportedOperationException(\"attempt to get long[] from string[] only scalar binding\");\n    }\n\n    @Override\n    public double[] getDoubleVector(String name)\n    {\n      throw new UnsupportedOperationException(\"attempt to get double[] from string[] only scalar binding\");\n    }\n\n    @Nullable\n    @Override\n    public boolean[] getNullVector(String name)\n    {\n      throw new UnsupportedOperationException(\"attempt to get boolean[] null vector from string[] only scalar binding\");\n    }\n  }\n}\n","sourceCodeStart":146,"sourceCodeEnd":175,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/virtual/SingleStringInputDeferredEvaluationExpressionDimensionVectorSelector.java#L146-L175","documentation":"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.","triggerScenarios":"Expression evaluation requests getDoubleVector(name) from the single-string-input binding, typically when an expression over a string column is vector-typed as double[].","commonSituations":"Expressions applying double math directly to string inputs under vectorization; planner typing mismatches after expression changes.","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"],"exampleFix":"// before\ndouble_func(string_col)\n// after\nCAST(string_col AS DOUBLE) -- then apply double_func","handlingStrategy":"try-catch","validationCode":"// ensure expression only uses string-compatible functions over the string input binding\nExpr.InputBindingTypes t = expr.analyzeInputs();\nif (!t.getRequiredBindings().isEmpty() && !isStringTyped(expr)) { /* replan */ }","typeGuard":null,"tryCatchPattern":"try {\n  return bindings.getDoubleVector(name);\n} catch (UnsupportedOperationException e) {\n  return evalAsDouble(bindings.getStringVector(name)); // or disable vectorization\n}","preventionTips":["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"],"tags":["druid","vectorized-query","expression","type-mismatch"],"backgroundTag":"unsupported-operation","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}