apache/beam · error · UnsupportedOperationException
Type is not supported
Error message
Type is not supported: ${type} What it means
The NFA's arithmetic helper (add) supports only INTEGER, BIGINT, DECIMAL, FLOAT and DOUBLE literals. When the left operand's Schema.TypeName is any other type it throws UnsupportedOperationException, because CEP condition arithmetic on that type is not implemented.
Solutions
- Cast or change the operand to a numeric type supported by the helper (INTEGER, BIGINT, DECIMAL, FLOAT, DOUBLE)
- Use supported string/date comparison operators instead of arithmetic for non-numeric types
- If the type should be supported, extend the switch in NFA.java's arithmetic implementation
Example fix
// before DEFINE e AS SOME_BOOL_COL + 1 // after DEFINE e AS SOME_INT_COL + 1
Defensive patterns
Strategy: type-guard
Validate before calling
Set<Schema.TypeName> supported = EnumSet.of(
Schema.TypeName.INTEGER, Schema.TypeName.BIGINT, Schema.TypeName.DECIMAL,
Schema.TypeName.FLOAT, Schema.TypeName.DOUBLE);
if (!supported.contains(leftOperandType)) {
throw new IllegalArgumentException("Arithmetic not supported for " + leftOperandType);
} Type guard
boolean isArithmeticSupported(Schema.TypeName t) {
return t == Schema.TypeName.INTEGER || t == Schema.TypeName.BIGINT
|| t == Schema.TypeName.DECIMAL || t == Schema.TypeName.FLOAT
|| t == Schema.TypeName.DOUBLE;
} Try / catch
try {
runCepQuery(pattern);
} catch (UnsupportedOperationException e) {
if (e.getMessage().startsWith("Type is not supported:")) {
// cast operands to a supported numeric type or simplify the expression
} else throw e;
} Prevention
- Only use numeric columns (INTEGER/BIGINT/DECIMAL/FLOAT/DOUBLE) in CEP arithmetic
- Cast non-numeric columns before pattern expressions
- Check the schema of the input PCollection against pattern expressions at query-authoring time
When it happens
Trigger: Evaluating an arithmetic (+) operation in a DEFINE clause where an operand literal type is not one of INTEGER/BIGINT/DECIMAL/FLOAT/DOUBLE (e.g. BOOLEAN, VARCHAR, DATE).
Common situations: Adding string-typed or boolean columns in a MATCH_RECOGNIZE DEFINE expression; schema columns typed as non-numeric Beam types used in arithmetic.
Related errors
- Types do not match
- CEP operation is not recognized
- RexNode not supported
- the comparator is not supported
- the first argument of the PREV operation should be a field…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/6233179d9c52db58.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/nfa/NFA.java:636
Schema.TypeName type2 = opr2.getTypeName();
if (type1.isNumericType() && type1 == type2) {
switch (type1) {
case BYTE:
return CEPLiteral.of(opr1.getByte() + opr2.getByte());
case INT16:
return CEPLiteral.of(opr1.getInt16() + opr2.getInt16());
case INT32:
return CEPLiteral.of(opr1.getInt32() + opr2.getInt32());
case INT64:
return CEPLiteral.of(opr1.getInt64() + opr2.getInt64());
case DECIMAL:
return CEPLiteral.of(opr1.getDecimal().add(opr2.getDecimal()));
case FLOAT:
return CEPLiteral.of(opr1.getFloat() + opr2.getFloat());
case DOUBLE:
return CEPLiteral.of(opr1.getDouble() + opr2.getDouble());
default:
throw new UnsupportedOperationException("Type is not supported: " + type1.toString());
}
} else {
throw new IllegalStateException(
"Types do not match: " + type1.toString() + ", " + type2.toString());
}
}
}
// State are determined directly by the PATTERN clause
private static class State implements Serializable {
private int index = 0; // number ith state (pointer value) in the NFA
private final String patternVar;
private final Quantifier quant;
private final CEPOperation
condition; // condition to evaluate when taking the "begin" action and "proceed" action
private State nextState = null;
public final boolean isFinal;
private final booleanView on GitHub (pinned to 12126d8942)