{"record":{"id":"55c24ecc8f27cf1a","repo":"apache/beam","slug":"rexnode-not-supported-classname","errorCode":null,"errorMessage":"RexNode not supported: ${className}","messagePattern":"RexNode not supported: (.+?)","errorType":"exception","errorClass":"SqlConversionException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/cep/CEPOperation.java","lineNumber":45,"sourceCode":"/**\n * {@code CEPOperation} is the base class for the evaluation operations defined in the {@code\n * DEFINE} syntax of {@code MATCH_RECOGNIZE}. {@code CEPCall}, {@code CEPFieldRef}, {@code\n * CEPLiteral} are the subclasses of it.\n */\npublic abstract class CEPOperation implements Serializable {\n\n  public static CEPOperation of(RexNode operation) {\n    if (operation.getClass() == RexCall.class) {\n      RexCall call = (RexCall) operation;\n      return CEPCall.of(call);\n    } else if (operation.getClass() == RexLiteral.class) {\n      RexLiteral lit = (RexLiteral) operation;\n      return CEPLiteral.of(lit);\n    } else if (operation.getClass() == RexPatternFieldRef.class) {\n      RexPatternFieldRef fieldRef = (RexPatternFieldRef) operation;\n      return CEPFieldRef.of(fieldRef);\n    } else {\n      throw new SqlConversionException(\"RexNode not supported: \" + operation.getClass().getName());\n    }\n  }\n}\n","sourceCodeStart":27,"sourceCodeEnd":49,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/cep/CEPOperation.java#L27-L49","documentation":"CEPOperation.of(RexNode) converts a Calcite RexNode expression tree into the CEP operation model. It only supports RexCall, RexLiteral, and RexPatternFieldRef; any other RexNode subclass (or unsupported RexCall kind) hits the else branch and raises SqlConversionException naming the offending class.","triggerScenarios":"A MATCH_RECOGNIZE query whose PATTERN/DEFINE/MEASURES expression compiles to a RexNode type outside the supported set — e.g. RexDynamicParam, RexInputRef, RexSubQuery, or exotic RexCall operators not mapped by the converter.","commonSituations":"Using subqueries, dynamic parameters, or unsupported SQL functions inside MATCH_RECOGNIZE clauses; Calcite optimizer rewrites producing RexNode shapes the CEP translator does not anticipate.","solutions":["Rewrite the query so DEFINE/MEASURES expressions only use simple field references, literals, and supported functions/operators.","Remove subqueries, dynamic parameters, or non-deterministic expressions from the MATCH_RECOGNIZE clause.","If the RexNode type is legitimately needed, extend CEPOperation.of() with a case handling that RexNode subclass.","Check the named class in the message to identify exactly which expression shape was rejected."],"exampleFix":"// before (unsupported)\nMATCH_RECOGNIZE (...) DEFINE A AS PREV(A.price) + (SELECT max(x) FROM t)\n// after\nMATCH_RECOGNIZE (...) DEFINE A AS PREV(A.price) + A.price","handlingStrategy":"validation","validationCode":"// Validate expression shapes before running MATCH_RECOGNIZE\nfor (RexNode n : defineExprs) {\n  if (!(n instanceof RexCall || n instanceof RexLiteral || n instanceof RexPatternFieldRef)) {\n    throw new IllegalArgumentException(\"Unsupported RexNode in MATCH_RECOGNIZE: \" + n.getClass());\n  }\n}","typeGuard":"boolean isSupportedRex(RexNode n) { return n instanceof RexCall || n instanceof RexLiteral || n instanceof RexPatternFieldRef; }","tryCatchPattern":"try { return CEPOperation.of(node); } catch (SqlConversionException e) { throw new QueryValidationException(\"Unsupported expression in MATCH_RECOGNIZE: \" + e.getMessage(), e); }","preventionTips":["Restrict DEFINE/MEASURES to field refs, literals, and supported functions.","Avoid subqueries and dynamic parameters inside MATCH_RECOGNIZE.","Test queries against the exact Calcite/Beam version in use, since optimizer rewrites vary."],"tags":["java","cep","sql","calcite","unsupported"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}