{"record":{"id":"de50a354e5aa1541","repo":"apache/beam","slug":"cep-operation-is-not-recognized-classname","errorCode":null,"errorMessage":"CEP operation is not recognized: ${className}","messagePattern":"CEP operation is not recognized: (.+?)","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamMatchRel.java","lineNumber":362,"sourceCode":"                  }\n                  break;\n                default:\n                  throw new UnsupportedOperationException(\n                      \"The measure function is not recognized: \" + funcName.name());\n              }\n            } else if (opr.getClass() == CEPFieldRef.class) {\n              Row rowToProc = patternRows.get(0);\n              CEPFieldRef fieldRef = (CEPFieldRef) opr;\n              if (newFieldBuilder == null) {\n                newFieldBuilder =\n                    newRowBuilder.withFieldValue(outName, rowToProc.getValue(fieldRef.getIndex()));\n              } else {\n                newFieldBuilder =\n                    newFieldBuilder.withFieldValue(\n                        outName, rowToProc.getValue(fieldRef.getIndex()));\n              }\n            } else {\n              throw new UnsupportedOperationException(\n                  \"CEP operation is not recognized: \" + opr.getClass().getName());\n            }\n          }\n          Row newRow;\n          if (newFieldBuilder == null) {\n            newRow = newRowBuilder.build();\n          } else {\n            newRow = newFieldBuilder.build();\n          }\n          out.output(newRow);\n        }\n      }\n    }\n  }\n\n  private static class SortPerKey extends DoFn<KV<Row, Iterable<Row>>, KV<Row, Iterable<Row>>> {\n\n    private final ArrayList<OrderKey> orderKeys;","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamMatchRel.java#L344-L380","documentation":"In BeamMatchRel's measure processing, each operand of the measure expression must be a recognized CEP operation class (e.g. CEPFieldRef, CEPOperation subclasses like function calls). If an operand's class is unknown, processElement throws UnsupportedOperationException with the class name.","triggerScenarios":"A MATCH_RECOGNIZE MEASURES/PATTERN expression containing an operator or operand type that isn't a known CEPOperation subclass, so opr.getClass() matches no branch in the if/else chain.","commonSituations":"Exotic measure expressions mixing unsupported Calcite operators with CEP references; version drift between Calcite and Beam CEP classes; hand-built RelNodes with non-CEP operands.","solutions":["Simplify the measure expression to plain field references and supported CEP functions (FIRST/LAST/etc.)","Verify all operands are deserialized as CEPOperation subclasses (check for class-loading/serialization issues if CEPOperands come from a plan)","Upgrade Beam/Calcite to a version where the operand class is handled"],"exampleFix":"// before\nMEASURES SOME_UNSUPPORTED_FUNC(price) AS p\n// after\nMEASURES FIRST(price) AS p","handlingStrategy":"validation","validationCode":"// Ensure all operands of measure expressions are simple field refs or supported CEP ops\nboolean isSupportedCepOperand(Object opr) {\n  return opr instanceof CEPFieldRef || SUPPORTED_CEP_OPERATION_CLASSES.stream().anyMatch(c -> c.isInstance(opr));\n}","typeGuard":null,"tryCatchPattern":"try {\n  result = sqlEnv.sqlQuery(q).evaluate();\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().startsWith(\"CEP operation is not recognized\")) {\n    // simplify the measure expression to supported CEP operations\n  } else throw e;\n}","preventionTips":["Keep MEASURES expressions simple (field refs plus FIRST/LAST)","\nVerify CEPOperand serialization/deserialization doesn't swap classes across versions","Track Beam CEP release notes for newly supported operation classes"],"tags":["sql","cep","match-recognize","beam"],"backgroundTag":"unsupported-operation","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"}