apache/druid · error · ISE

Unsupported expression type[%s]

Error message

Unsupported expression type[%s]

What it means

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.

Source

Thrown at processing/src/main/java/org/apache/druid/math/expr/ExpressionType.java:222

      case DOUBLE:
        return ColumnType.DOUBLE;
      case STRING:
        return ColumnType.STRING;
      case ARRAY:
        switch (exprType.getElementType().getType()) {
          case LONG:
            return ColumnType.LONG_ARRAY;
          case DOUBLE:
            return ColumnType.DOUBLE_ARRAY;
          case STRING:
            return ColumnType.STRING_ARRAY;
          default:
            return ColumnType.ofArray(toColumnType((ExpressionType) exprType.getElementType()));
        }
      case COMPLEX:
        return ColumnType.ofComplex(exprType.getComplexTypeName());
      default:
        throw new ISE("Unsupported expression type[%s]", exprType);
    }
  }
}

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Only pass ExpressionTypes obtained from ExpressionTypeFactory or ExpressionType constants — never hand-constructed instances.
  2. Verify all Druid processing modules are the same version so ExprType enums match.
  3. Catch ISE, log exprType.getType(), and inspect how the ExpressionType was created.
  4. If you need a new expression kind, extend the switch in toColumnType() upstream rather than working around it.
Defensive patterns

Strategy: type-guard

Validate before calling

ExprType kind = exprType.getType();
if (kind != ExprType.LONG && kind != ExprType.DOUBLE && kind != ExprType.STRING
    && kind != ExprType.ARRAY && kind != ExprType.COMPLEX) {
  throw new IllegalArgumentException("toColumnType cannot handle: " + kind);
}

Type guard

boolean isColumnConvertible(ExpressionType t) {
  switch (t.getType()) {
    case LONG: case DOUBLE: case STRING: case ARRAY: case COMPLEX: return true;
    default: return false;
  }
}

Try / catch

try {
  ColumnType ct = ExpressionType.toColumnType(exprType);
} catch (IllegalStateException e) {
  log.error("Cannot convert expression type %s", exprType); throw e;
}

Prevention

When it happens

Trigger: Calling ExpressionType.toColumnType() with an ExpressionType whose getType() is not LONG, DOUBLE, STRING, ARRAY, or COMPLEX (e.g. a malformed or future/unknown ExprType).

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/8a27551ae3f1422d. Report an issue: GitHub.