apache/beam · error · UnsupportedOperationException

RexNode not supported:

Error message

RexNode not supported: 

What it means

When translating a Calcite MATCH_RECOGNIZE (CEP) pattern, CEPCall.of converts each RexNode operand of a call; only RexLiteral and RexPatternFieldRef operands are supported. Any other RexNode subtype (e.g. a nested RexCall, RexInputRef) hits the else branch and throws UnsupportedOperationException naming the operand class.

Solutions

  1. Rewrite the pattern expression so operands are only literals and pattern field references (RexPatternFieldRef)
  2. Pre-compute nested expressions outside the MATCH_RECOGNIZE clause (e.g. in a subquery/projection) and reference them as fields
  3. Check the operand class reported in the message and file a/look for a Beam JIRA to add support for that RexNode type

Example fix

// before
DEFINE x AS price * qty > 100  -- nested RexCall operand
// after
SELECT * FROM (SELECT *, price * qty AS amount FROM t) MATCH_RECOGNIZE (... DEFINE x AS amount > 100 ...)
Defensive patterns

Strategy: validation

Validate before calling

for (RexNode op : call.getOperands()) {
  if (!(op instanceof RexLiteral) && !(op instanceof RexPatternFieldRef))
    throw new IllegalArgumentException("Unsupported CEP operand: " + op.getClass().getSimpleName());
}

Type guard

static boolean isCepSupportedOperand(RexNode n) {
  return n instanceof RexLiteral || n instanceof RexPatternFieldRef;
}

Try / catch

try {
  CEPCall c = CEPCall.of(op, operands);
} catch (UnsupportedOperationException e) {
  if (e.getMessage().startsWith("RexNode not supported")) {
    throw new IllegalStateException("Simplify MATCH_RECOGNIZE expression: " + e.getMessage(), e);
  } else throw e;
}

Prevention

When it happens

Trigger: Using a MATCH_RECOGNIZE pattern whose DEFINE/PARAMETER expressions contain nested function calls or unsupported RexNode operands instead of plain literals and pattern field references.

Common situations: Writing complex CEP DEFINE clauses with arithmetic or nested SQL function calls that Beam SQL's CEP translator does not yet support; porting standard SQL MATCH_RECOGNIZE queries that use richer expressions.

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/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/663d5f6010a2d262. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/cep/CEPCall.java:68

  public static CEPCall of(RexCall operation) {
    SqlOperator call = operation.getOperator();
    CEPOperator myOp = CEPOperator.of(call);

    ArrayList<CEPOperation> operandsList = new ArrayList<>();
    for (RexNode i : operation.getOperands()) {
      if (i.getClass() == RexCall.class) {
        CEPCall callToAdd = CEPCall.of((RexCall) i);
        operandsList.add(callToAdd);
      } else if (i.getClass() == RexLiteral.class) {
        RexLiteral lit = (RexLiteral) i;
        CEPLiteral litToAdd = CEPLiteral.of(lit);
        operandsList.add(litToAdd);
      } else if (i.getClass() == RexPatternFieldRef.class) {
        RexPatternFieldRef fieldRef = (RexPatternFieldRef) i;
        CEPFieldRef fieldRefToAdd = CEPFieldRef.of(fieldRef);
        operandsList.add(fieldRefToAdd);
      } else {
        throw new UnsupportedOperationException("RexNode not supported: " + i.getClass().getName());
      }
    }

    return new CEPCall(myOp, operandsList);
  }

  @Override
  public String toString() {
    ArrayList<String> operandStrings = new ArrayList<>();
    for (CEPOperation i : operands) {
      operandStrings.add(i.toString());
    }
    return operator.toString() + "(" + String.join(", ", operandStrings) + ")";
  }
}

View on GitHub (pinned to 12126d8942)