{"record":{"id":"8a27551ae3f1422d","repo":"apache/druid","slug":"unsupported-expression-type-s","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/ExpressionType.java","lineNumber":222,"sourceCode":"      case DOUBLE:\n        return ColumnType.DOUBLE;\n      case STRING:\n        return ColumnType.STRING;\n      case ARRAY:\n        switch (exprType.getElementType().getType()) {\n          case LONG:\n            return ColumnType.LONG_ARRAY;\n          case DOUBLE:\n            return ColumnType.DOUBLE_ARRAY;\n          case STRING:\n            return ColumnType.STRING_ARRAY;\n          default:\n            return ColumnType.ofArray(toColumnType((ExpressionType) exprType.getElementType()));\n        }\n      case COMPLEX:\n        return ColumnType.ofComplex(exprType.getComplexTypeName());\n      default:\n        throw new ISE(\"Unsupported expression type[%s]\", exprType);\n    }\n  }\n}\n","sourceCodeStart":204,"sourceCodeEnd":226,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/math/expr/ExpressionType.java#L204-L226","documentation":"toColumnType() converts an ExpressionType back to a Druid ColumnType. ExpressionTypes of a kind not covered by LONG/DOUBLE/STRING/ARRAY/COMPLEX have no column-type equivalent, so the method throws ISE. This is an internal invariant violation: a valid ExpressionType should always be one of the handled kinds.","triggerScenarios":"Calling ExpressionType.toColumnType() with an ExpressionType whose getType() is not LONG, DOUBLE, STRING, ARRAY, or COMPLEX (e.g. a malformed or future/unknown ExprType).","commonSituations":"Extension or test code constructing arbitrary ExpressionType instances; deserializing expression types from an incompatible Druid version; bugs in custom expression modules that invent new ExprType values.","solutions":["Only pass ExpressionTypes obtained from ExpressionTypeFactory or ExpressionType constants — never hand-constructed instances.","Verify all Druid processing modules are the same version so ExprType enums match.","Catch ISE, log exprType.getType(), and inspect how the ExpressionType was created.","If you need a new expression kind, extend the switch in toColumnType() upstream rather than working around it."],"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 IllegalArgumentException(\"toColumnType cannot handle: \" + kind);\n}","typeGuard":"boolean isColumnConvertible(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  ColumnType ct = ExpressionType.toColumnType(exprType);\n} catch (IllegalStateException e) {\n  log.error(\"Cannot convert expression type %s\", exprType); throw e;\n}","preventionTips":["Construct ExpressionTypes only via ExpressionTypeFactory","Avoid hand-built ExpressionType instances","Keep versions aligned across Druid modules"],"tags":["druid","expressions","type-conversion","unsupported-type"],"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"}