apache/skywalking · error · IllegalArgumentException

Unsupported number operator: {}

Error message

Unsupported number operator: {}

What it means

Thrown while mapping a number-valued OAL filter to a matcher expression type. Number values support only the comparison operators EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_EQUAL, LESS_EQUAL; any other operator (LIKE, CONTAIN, NOT_CONTAIN) has no number matcher and the switch falls to default.

Source

Thrown at oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/v2/generator/MetricDefinitionEnricher.java:473

     *
     * @param filterExpr filter expression containing operator and value
     * @return matcher type string (e.g., "stringMatch", "greaterMatch")
     */
    private String mapOperatorToExpressionType(FilterExpression filterExpr) {
        FilterOperator op = filterExpr.getOperator();
        FilterValue value = filterExpr.getValue();

        if (value.isBoolean()) {
            return op == FilterOperator.EQUAL ? "booleanMatch" : "booleanNotEqualMatch";
        } else if (value.isNumber()) {
            switch (op) {
                case EQUAL: return "numberMatch";
                case NOT_EQUAL: return "notEqualMatch";
                case GREATER: return "greaterMatch";
                case LESS: return "lessMatch";
                case GREATER_EQUAL: return "greaterEqualMatch";
                case LESS_EQUAL: return "lessEqualMatch";
                default: throw new IllegalArgumentException("Unsupported number operator: " + op);
            }
        } else if (value.isString()) {
            switch (op) {
                case EQUAL: return "stringMatch";
                case NOT_EQUAL: return "notEqualMatch";
                case LIKE: return "likeMatch";
                case CONTAIN: return "containMatch";
                case NOT_CONTAIN: return "notContainMatch";
                default: throw new IllegalArgumentException("Unsupported string operator: " + op);
            }
        } else if (value.isArray()) {
            return "inMatch";
        } else if (value.isNull()) {
            return op == FilterOperator.EQUAL ? "stringMatch" : "notEqualMatch";
        } else if (value.isEnum()) {
            // Enum comparisons use string matching (e.g., type == RequestType.MQ)
            switch (op) {
                case EQUAL: return "stringMatch";

View on GitHub (pinned to 102af09b4a)

Solutions

  1. Replace the operator with a numeric comparison: =, !=, >, <, >=, <= (e.g. latency > 100)
  2. If substring matching on a number is truly needed, first expose/cast the attribute as a string (e.g. via (str->long)-style casts in reverse is not supported — instead filter on a string attribute)

Example fix

// before (OAL)
slow = from Endpoint.latency like '99%' --> slowEndpoints
// after
slow = from Endpoint.latency > 990 --> slowEndpoints
Defensive patterns

Strategy: validation

Validate before calling

// Lint rule: numeric attribute + string operator => reject before deploy
if (attrIsNumeric(attr) && op.in(LIKE, CONTAIN, NOT_CONTAIN)) {
    throw new ConfigException("Operator " + op + " not valid for numeric " + attr);
}

Try / catch

In OAL lint tooling, catch IllegalArgumentException from the enricher and report file:line of the offending rule; never blanket-catch in OAP startup.

Prevention

When it happens

Trigger: An OAL rule applies a string-only operator to a numeric attribute, e.g. from Source where latency like '1%' or duration contain '2'. The value is classified as a number, the operator is not in the number set, and generation aborts.

Common situations: Writing OAL filters against numeric attributes (latency, duration, status code) with SQL habits carried over (LIKE on numbers); refactoring a filter from a string attribute to a numeric one without changing the operator.

Related errors


AI-assisted analysis of apache/skywalking@102af09b4a (2026-08-14). Data as JSON: /api/errors/f9e4764150d15f49. Report an issue: GitHub.