{"record":{"id":"1df295ac9d527d92","repo":"apache/skywalking","slug":"unsupported-enum-operator","errorCode":null,"errorMessage":"Unsupported enum operator: {}","messagePattern":"Unsupported enum 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":493,"sourceCode":"        } 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\";\n                case NOT_EQUAL: return \"notEqualMatch\";\n                default: throw new IllegalArgumentException(\"Unsupported enum operator: \" + op);\n            }\n        }\n\n        throw new IllegalArgumentException(\"Unsupported filter: \" + filterExpr);\n    }\n\n    /**\n     * Collect persistent fields from metrics class @Column annotations.\n     */\n    private List<CodeGenModel.DataFieldV2> collectPersistentFields(Class<? extends Metrics> metricsClass) {\n        List<CodeGenModel.DataFieldV2> persistentFields = new ArrayList<>();\n        Class<?> c = metricsClass;\n        while (!c.equals(Object.class)) {\n            for (Field field : c.getDeclaredFields()) {\n                Column column = field.getAnnotation(Column.class);\n                if (column != null) {\n                    persistentFields.add(CodeGenModel.DataFieldV2.builder()\n                        .fieldName(field.getName())","sourceCodeStart":475,"sourceCodeEnd":511,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/v2/generator/MetricDefinitionEnricher.java#L475-L511","documentation":"Thrown while mapping an enum-valued OAL filter to a matcher type. Enum comparisons are lowered to string matching, and only EQUAL and NOT_EQUAL are supported; any other operator against an enum constant falls to default.","triggerScenarios":"An OAL rule uses an ordering or substring operator against an enum constant, e.g. from X where type like RequestType.MQ or type > RequestType.HTTP. The enum branch only accepts = and !=.","commonSituations":"Filtering span/request type enums with operators copied from string filters; adding new enum-attribute sources and reusing an old filter line unchanged.","solutions":["Use only equality or inequality against enum constants: type = RequestType.MQ or type != RequestType.MQ","If richer matching is needed, filter on the corresponding string attribute instead of the enum"],"exampleFix":"// before (OAL)\nmqSpans = from Span where type like RequestType.MQ --> mqSpans\n// after\nmqSpans = from Span where type = RequestType.MQ --> mqSpans","handlingStrategy":"validation","validationCode":"// Lint rule: enum value + non-equality operator => reject before deploy\nif (value.isEnum() && op != EQUAL && op != NOT_EQUAL) {\n    throw new ConfigException(\"Enum filter supports only = and !=, got \" + op);\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":["Use only = and != against enum constants in OAL","If substring/order semantics are needed, filter the string form of the attribute instead"],"tags":["oal","filter","enum","operator-mismatch"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}