{"record":{"id":"a98b2ffab0e906c0","repo":"apache/druid","slug":"float-types-are-not-supported-natively-by-druid-ex","errorCode":null,"errorMessage":"FLOAT types are not supported natively by Druid expressions","messagePattern":"FLOAT types are not supported natively by Druid expressions","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/math/expr/ExpressionTypeFactory.java","lineNumber":56,"sourceCode":"  {\n    return INSTANCE;\n  }\n\n  private ExpressionTypeFactory()\n  {\n    // no instantiation\n  }\n\n  @Override\n  public ExpressionType ofString()\n  {\n    return ExpressionType.STRING;\n  }\n\n  @Override\n  public ExpressionType ofFloat()\n  {\n    throw new IllegalStateException(\"FLOAT types are not supported natively by Druid expressions\");\n  }\n\n  @Override\n  public ExpressionType ofDouble()\n  {\n    return ExpressionType.DOUBLE;\n  }\n\n  @Override\n  public ExpressionType ofLong()\n  {\n    return ExpressionType.LONG;\n  }\n\n  @Override\n  public ExpressionType ofArray(ExpressionType elementType)\n  {\n    if (elementType.isPrimitive()) {","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/math/expr/ExpressionTypeFactory.java#L38-L74","documentation":"The Druid expression system has no native FLOAT representation — it folds all floating point into DOUBLE. ExpressionTypeFactory.ofFloat() (the TypeFactory<ExpressionType> implementation) therefore unconditionally throws IllegalStateException to signal that FLOAT cannot be used as an expression type.","triggerScenarios":"Calling ExpressionTypeFactory.getInstance().ofFloat(), or generic code that iterates TypeFactory methods / ValueType values and invokes ofFloat() when building expression types from a ValueType.FLOAT.","commonSituations":"Generic type-conversion code that maps each ValueType via the factory instead of special-casing FLOAT; extensions or tests written against the TypeFactory interface assuming all value types are supported; upgrading code paths that previously used floats.","solutions":["Use ofDouble() instead — FLOAT columns are already promoted to DOUBLE by fromColumnType/fromColumnTypeStrict.","Route ValueType.FLOAT through ExpressionType.DOUBLE in your conversion code rather than calling ofFloat().","Call ColumnType.ofFloat()/TypeFactory for column types if you truly need FLOAT, keeping it out of the expression layer.","Catch IllegalStateException and substitute ExpressionType.DOUBLE as a fallback."],"exampleFix":"// before\nExpressionType t = ExpressionTypeFactory.getInstance().ofFloat();\n// after\nExpressionType t = ExpressionTypeFactory.getInstance().ofDouble(); // expressions treat FLOAT as DOUBLE","handlingStrategy":"type-guard","validationCode":"if (valueType == ValueType.FLOAT) {\n  ExpressionType t = ExpressionType.DOUBLE; // expressions have no FLOAT\n} else {\n  ExpressionType t = fromValue(valueType);\n}","typeGuard":"boolean isFloatValue(ValueType t) { return t == ValueType.FLOAT; }","tryCatchPattern":"try {\n  ExpressionType t = factory.ofFloat();\n} catch (IllegalStateException e) {\n  ExpressionType t = ExpressionType.DOUBLE;\n}","preventionTips":["Remember the expression layer only supports LONG, DOUBLE, STRING, arrays, COMPLEX","Always map ValueType.FLOAT to ExpressionType.DOUBLE","Never call ofFloat(); use ofDouble() or fromColumnType()"],"tags":["druid","expressions","unsupported-type","float"],"backgroundTag":"unsupported-dtype","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"}