{"record":{"id":"6233179d9c52db58","repo":"apache/beam","slug":"type-is-not-supported-type","errorCode":null,"errorMessage":"Type is not supported: ${type}","messagePattern":"Type is not supported: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/nfa/NFA.java","lineNumber":636,"sourceCode":"      Schema.TypeName type2 = opr2.getTypeName();\n      if (type1.isNumericType() && type1 == type2) {\n        switch (type1) {\n          case BYTE:\n            return CEPLiteral.of(opr1.getByte() + opr2.getByte());\n          case INT16:\n            return CEPLiteral.of(opr1.getInt16() + opr2.getInt16());\n          case INT32:\n            return CEPLiteral.of(opr1.getInt32() + opr2.getInt32());\n          case INT64:\n            return CEPLiteral.of(opr1.getInt64() + opr2.getInt64());\n          case DECIMAL:\n            return CEPLiteral.of(opr1.getDecimal().add(opr2.getDecimal()));\n          case FLOAT:\n            return CEPLiteral.of(opr1.getFloat() + opr2.getFloat());\n          case DOUBLE:\n            return CEPLiteral.of(opr1.getDouble() + opr2.getDouble());\n          default:\n            throw new UnsupportedOperationException(\"Type is not supported: \" + type1.toString());\n        }\n      } else {\n        throw new IllegalStateException(\n            \"Types do not match: \" + type1.toString() + \", \" + type2.toString());\n      }\n    }\n  }\n\n  // State are determined directly by the PATTERN clause\n  private static class State implements Serializable {\n    private int index = 0; // number ith state (pointer value) in the NFA\n    private final String patternVar;\n    private final Quantifier quant;\n    private final CEPOperation\n        condition; // condition to evaluate when taking the \"begin\" action and \"proceed\" action\n    private State nextState = null;\n    public final boolean isFinal;\n    private final boolean","sourceCodeStart":618,"sourceCodeEnd":654,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/nfa/NFA.java#L618-L654","documentation":"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.","triggerScenarios":"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).","commonSituations":"Adding string-typed or boolean columns in a MATCH_RECOGNIZE DEFINE expression; schema columns typed as non-numeric Beam types used in arithmetic.","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"],"exampleFix":"// before\nDEFINE e AS SOME_BOOL_COL + 1\n// after\nDEFINE e AS SOME_INT_COL + 1","handlingStrategy":"type-guard","validationCode":"Set<Schema.TypeName> supported = EnumSet.of(\n  Schema.TypeName.INTEGER, Schema.TypeName.BIGINT, Schema.TypeName.DECIMAL,\n  Schema.TypeName.FLOAT, Schema.TypeName.DOUBLE);\nif (!supported.contains(leftOperandType)) {\n  throw new IllegalArgumentException(\"Arithmetic not supported for \" + leftOperandType);\n}","typeGuard":"boolean isArithmeticSupported(Schema.TypeName t) {\n  return t == Schema.TypeName.INTEGER || t == Schema.TypeName.BIGINT\n      || t == Schema.TypeName.DECIMAL || t == Schema.TypeName.FLOAT\n      || t == Schema.TypeName.DOUBLE;\n}","tryCatchPattern":"try {\n  runCepQuery(pattern);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().startsWith(\"Type is not supported:\")) {\n    // cast operands to a supported numeric type or simplify the expression\n  } else throw e;\n}","preventionTips":["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"],"tags":["sql","cep","arithmetic","type-support"],"backgroundTag":"unsupported-dtype","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}