{"record":{"id":"f9e4764150d15f49","repo":"apache/skywalking","slug":"unsupported-number-operator","errorCode":null,"errorMessage":"Unsupported number operator: {}","messagePattern":"Unsupported number operator: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/v2/generator/MetricDefinitionEnricher.java","lineNumber":473,"sourceCode":"     *\n     * @param filterExpr filter expression containing operator and value\n     * @return matcher type string (e.g., \"stringMatch\", \"greaterMatch\")\n     */\n    private String mapOperatorToExpressionType(FilterExpression filterExpr) {\n        FilterOperator op = filterExpr.getOperator();\n        FilterValue value = filterExpr.getValue();\n\n        if (value.isBoolean()) {\n            return op == FilterOperator.EQUAL ? \"booleanMatch\" : \"booleanNotEqualMatch\";\n        } else if (value.isNumber()) {\n            switch (op) {\n                case EQUAL: return \"numberMatch\";\n                case NOT_EQUAL: return \"notEqualMatch\";\n                case GREATER: return \"greaterMatch\";\n                case LESS: return \"lessMatch\";\n                case GREATER_EQUAL: return \"greaterEqualMatch\";\n                case LESS_EQUAL: return \"lessEqualMatch\";\n                default: throw new IllegalArgumentException(\"Unsupported number operator: \" + op);\n            }\n        } else if (value.isString()) {\n            switch (op) {\n                case EQUAL: return \"stringMatch\";\n                case NOT_EQUAL: return \"notEqualMatch\";\n                case LIKE: return \"likeMatch\";\n                case CONTAIN: return \"containMatch\";\n                case NOT_CONTAIN: return \"notContainMatch\";\n                default: throw new IllegalArgumentException(\"Unsupported string operator: \" + op);\n            }\n        } else if (value.isArray()) {\n            return \"inMatch\";\n        } else if (value.isNull()) {\n            return op == FilterOperator.EQUAL ? \"stringMatch\" : \"notEqualMatch\";\n        } else if (value.isEnum()) {\n            // Enum comparisons use string matching (e.g., type == RequestType.MQ)\n            switch (op) {\n                case EQUAL: return \"stringMatch\";","sourceCodeStart":455,"sourceCodeEnd":491,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/v2/generator/MetricDefinitionEnricher.java#L455-L491","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Replace the operator with a numeric comparison: =, !=, >, <, >=, <= (e.g. latency > 100)","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)"],"exampleFix":"// before (OAL)\nslow = from Endpoint.latency like '99%' --> slowEndpoints\n// after\nslow = from Endpoint.latency > 990 --> slowEndpoints","handlingStrategy":"validation","validationCode":"// Lint rule: numeric attribute + string operator => reject before deploy\nif (attrIsNumeric(attr) && op.in(LIKE, CONTAIN, NOT_CONTAIN)) {\n    throw new ConfigException(\"Operator \" + op + \" not valid for numeric \" + attr);\n}","typeGuard":null,"tryCatchPattern":"In OAL lint tooling, catch IllegalArgumentException from the enricher and report file:line of the offending rule; never blanket-catch in OAP startup.","preventionTips":["Match operator family to attribute type: numeric gets = != > < >= <=; string gets = != like contain notContain","Run the OAL script through the dsl-debugging compile API before deploying via dynamic configuration"],"tags":["oal","filter","operator-mismatch","validation"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}