apache/beam · error · UnsupportedOperationException

the function is not supported for now

Error message

the function is not supported for now: ${cepKind}

What it means

NFA.evalLeftSideCondition evaluates the left operand of a comparison by recursively reducing CEPOperator calls (e.g. CLASS, PREV, PLUS). Only a fixed set of CepKinds is handled; any other operator kind (PLUS intervals, EXTRACT, etc. not implemented) throws UnsupportedOperationException naming the CepKind.

Solutions

  1. Rewrite the condition so the left side only uses supported functions (field access, PREV, supported arithmetic).
  2. Precompute the expression as a new schema field upstream and compare that field in DEFINE.
  3. Extend evalLeftSideCondition with a case for the missing CepKind (mirroring the plus() helper).
  4. Symmetrically check evalRightSideCondition — the same operator must be supported on the side where it appears.

Example fix

// before
DEFINE A AS A.price - A.cost > 0
// after (upstream field)
.addField("margin", FieldType.DOUBLE) // price - cost
// DEFINE A AS A.margin > 0
Defensive patterns

Strategy: validation

Validate before calling

// Check the left-side CepKind before building the query
if (!SUPPORTED_LEFT_KINDS.contains(cepKind)) {
  throw new IllegalArgumentException("Left-side operator not supported by CEP: " + cepKind);
}

Type guard

boolean isSupportedLeftOp(CEPOperation op) { return op instanceof CEPOperator && SUPPORTED_LEFT_KINDS.contains(((CEPOperator) op).getCepKind()); }

Try / catch

try { return evalLeftSideCondition(op, event); } catch (UnsupportedOperationException e) { throw new QueryValidationException("Unsupported operator in DEFINE left side", e); }

Prevention

When it happens

Trigger: A DEFINE left-side expression using an arithmetic/logical operator whose CepKind is absent from the switch (e.g. MINUS, DIVIDE, TIMES, EXTRACT) in a MATCH_RECOGNIZE query.

Common situations: Writing conditions like A.price - A.cost > 0 or division/comparison of computed expressions that the CEP layer does not yet support.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/411e5575b8c96778. 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:522

    private CEPLiteral evalLeftSideCondition(CEPOperation inputOperation, Event inputEvent) {
      if (inputOperation instanceof CEPLiteral) {
        return (CEPLiteral) inputOperation;
      } else if (inputOperation.getClass() == CEPFieldRef.class) {
        return inputEvent.toCEPLiteral((CEPFieldRef) inputOperation);
      } else if (inputOperation.getClass() == CEPCall.class) {
        CEPCall call = (CEPCall) inputOperation;
        CEPOperator operator = call.getOperator();
        List<CEPOperation> operands = call.getOperands();
        switch (operator.getCepKind()) {
          case LAST:
            return last(
                operands.get(0), evalLeftSideCondition(operands.get(1), inputEvent), inputEvent);
          case PLUS:
            return plus(
                evalLeftSideCondition(operands.get(0), inputEvent),
                evalLeftSideCondition(operands.get(1), inputEvent));
          default:
            throw new UnsupportedOperationException(
                "the function is not supported for now: " + operator.getCepKind().toString());
        }
      } else {
        throw new IllegalStateException(
            "the left side CEP operation is not legal: " + inputOperation.getClass().toString());
      }
    }

    // evaluates the condition value (right) given an input event
    private CEPLiteral evalRightSideCondition(CEPOperation inputOperation, Event inputEvent) {
      if (inputOperation instanceof CEPLiteral) {
        return (CEPLiteral) inputOperation;
      } else if (inputOperation.getClass() == CEPCall.class) {
        CEPCall call = (CEPCall) inputOperation;
        CEPOperator operator = call.getOperator();
        List<CEPOperation> operands = call.getOperands();
        switch (operator.getCepKind()) {
          case PLUS:

View on GitHub (pinned to 12126d8942)