{"record":{"id":"6a6d183909d78b1f","repo":"apache/druid","slug":"unsupported-unknown-value-type","errorCode":null,"errorMessage":"Unsupported unknown value type","messagePattern":"Unsupported unknown value type","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/math/expr/ExpressionType.java","lineNumber":125,"sourceCode":"        case COMPLEX:\n          return elementType;\n      }\n    }\n    return elementType;\n  }\n\n\n  /**\n   * The expression system does not distinguish between {@link ValueType#FLOAT} and {@link ValueType#DOUBLE}, so,\n   * this method will convert {@link ValueType#FLOAT} to {@link #DOUBLE}. Null values are not allowed in this method,\n   * and will result in an {@link IllegalStateException}\n   *\n   * @throws IllegalStateException\n   */\n  public static ExpressionType fromColumnTypeStrict(@Nullable TypeSignature<ValueType> valueType)\n  {\n    if (valueType == null) {\n      throw new IllegalStateException(\"Unsupported unknown value type\");\n    }\n    switch (valueType.getType()) {\n      case LONG:\n        return LONG;\n      case FLOAT:\n      case DOUBLE:\n        return DOUBLE;\n      case STRING:\n        return STRING;\n      case ARRAY:\n        switch (valueType.getElementType().getType()) {\n          case LONG:\n            return LONG_ARRAY;\n          case FLOAT:\n          case DOUBLE:\n            return DOUBLE_ARRAY;\n          case STRING:\n            return STRING_ARRAY;","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/math/expr/ExpressionType.java#L107-L143","documentation":"ExpressionType.fromColumnTypeStrict() converts a Druid column type signature into an expression type and explicitly does not allow null input: the expression system needs a concrete type to plan evaluation. A null TypeSignature<ValueType> ('unknown' type) is rejected with IllegalStateException. The non-strict variant fromColumnType() returns null instead, so this error signals a code path that requires a known column type but was handed an unknown one.","triggerScenarios":"Calling ExpressionType.fromColumnTypeStrict(null), or passing a column whose TypeSignature is unknown/null — e.g. resolving expression output types for a column that has no declared type (undefined/unknown columns in a segment or subquery).","commonSituations":"Querying expressions against segments or datasources where a column's type cannot be determined (missing column, unknown complex type, or inline/lookup input lacking type info); extension code that calls fromColumnTypeStrict instead of the null-tolerant fromColumnType.","solutions":["Use ExpressionType.fromColumnType() instead if an unknown type is acceptable (it returns null rather than throwing).","Guard the input before calling: check valueType != null (or resolve the actual column type from the RowSignature) before calling fromColumnTypeStrict.","Fix the upstream source of the unknown type: ensure the column is declared in the RowSignature/datasource schema so its TypeSignature is resolved.","Catch IllegalStateException at the call site and fall back to a default expression type if a default makes sense."],"exampleFix":"// before\nExpressionType exprType = ExpressionType.fromColumnTypeStrict(signature);\n// after\nExpressionType exprType = signature == null\n    ? ExpressionType.STRING // or handle explicitly\n    : ExpressionType.fromColumnTypeStrict(signature);","handlingStrategy":"validation","validationCode":"if (valueType == null) {\n  // resolve or default before calling\n  valueType = rowSignature.getColumnSignature(columnName); // must be non-null\n}\nExpressionType t = ExpressionType.fromColumnTypeStrict(valueType);","typeGuard":"boolean hasKnownType(TypeSignature<ValueType> sig) { return sig != null; }","tryCatchPattern":"try {\n  ExpressionType t = ExpressionType.fromColumnTypeStrict(sig);\n} catch (IllegalStateException e) {\n  ExpressionType t = ExpressionType.fromColumnType(sig); // null-tolerant fallback\n}","preventionTips":["Prefer fromColumnType() when unknown types are possible","Check RowSignature column presence before strict conversion","Never pass unresolved type signatures into strict conversion paths"],"tags":["druid","expressions","type-conversion","null-argument"],"backgroundTag":"null-argument","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}