{"record":{"id":"1f07a87405c99fe6","repo":"apache/druid","slug":"unsupported-expression-type-s-1f07a8","errorCode":null,"errorMessage":"Unsupported expression type[%s]","messagePattern":"Unsupported expression type\\[(.+?)\\]","errorType":"exception","errorClass":"ISE","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/math/expr/ExpressionTypeFactory.java","lineNumber":121,"sourceCode":"        break;\n      case DOUBLE:\n        strategy = TypeStrategies.DOUBLE;\n        break;\n      case STRING:\n        strategy = TypeStrategies.STRING;\n        break;\n      case ARRAY:\n        strategy = new TypeStrategies.ArrayTypeStrategy(expressionType);\n        break;\n      case COMPLEX:\n        TypeStrategy<?> complexStrategy = TypeStrategies.getComplex(expressionType.getComplexTypeName());\n        if (complexStrategy == null) {\n          throw new IAE(\"Cannot find strategy for type [%s]\", expressionType.asTypeString());\n        }\n        strategy = complexStrategy;\n        break;\n      default:\n        throw new ISE(\"Unsupported expression type[%s]\", expressionType.getType());\n    }\n    return strategy;\n  }\n}\n","sourceCodeStart":103,"sourceCodeEnd":126,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/math/expr/ExpressionTypeFactory.java#L103-L126","documentation":"getTypeStrategy() switches on the ExpressionType's kind (LONG, DOUBLE, STRING, ARRAY, COMPLEX). Any other ExprType value has no TypeStrategy and triggers ISE 'Unsupported expression type[x]'. This is an internal invariant check — valid ExpressionTypes are always one of the handled kinds, so this indicates a malformed or future-version ExpressionType reached the factory.","triggerScenarios":"Calling ExpressionTypeFactory.getInstance().getTypeStrategy(exprType) with an ExpressionType whose getType() is not LONG/DOUBLE/STRING/ARRAY/COMPLEX (hand-constructed, corrupted, or from an incompatible Druid version).","commonSituations":"Custom expression extensions introducing new ExprType values without registering a strategy; deserializing expression types across mismatched Druid versions; test code constructing ExpressionType directly.","solutions":["Only pass ExpressionTypes produced by ExpressionTypeFactory/ExpressionType constants into getTypeStrategy().","Align all Druid module versions so ExprType enums are consistent.","If a new ExprType was added by an extension, register a corresponding TypeStrategy and extend the switch upstream.","Catch ISE, log expressionType.getType(), and trace where the malformed type was constructed."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"ExprType kind = exprType.getType();\nif (kind != ExprType.LONG && kind != ExprType.DOUBLE && kind != ExprType.STRING\n    && kind != ExprType.ARRAY && kind != ExprType.COMPLEX) {\n  throw new IllegalStateException(\"No TypeStrategy for ExprType \" + kind);\n}","typeGuard":"boolean hasTypeStrategy(ExpressionType t) {\n  switch (t.getType()) {\n    case LONG: case DOUBLE: case STRING: case ARRAY: case COMPLEX: return true;\n    default: return false;\n  }\n}","tryCatchPattern":"try {\n  TypeStrategy<?> s = ExpressionTypeFactory.getInstance().getTypeStrategy(exprType);\n} catch (IllegalStateException e) {\n  log.error(\"Unsupported ExprType %s\", exprType.getType()); throw e;\n}","preventionTips":["Only pass factory-produced ExpressionTypes to getTypeStrategy()","Register a TypeStrategy for any new ExprType added by extensions","Keep ExprType definitions version-aligned across modules"],"tags":["druid","expressions","unsupported-type","type-strategy"],"backgroundTag":"unsupported-operation","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"}