{"record":{"id":"887c8b7bb38433bf","repo":"apache/skywalking","slug":"unsupported-function-887c8b","errorCode":null,"errorMessage":"Unsupported function.","messagePattern":"Unsupported function\\.","errorType":"exception","errorClass":"IllegalExpressionException","httpStatus":null,"severity":"error","filePath":"oap-server/mqe-rt/src/main/java/org/apache/skywalking/mqe/rt/operation/TrendOp.java","lineNumber":41,"sourceCode":"import org.apache.skywalking.mqe.rt.exception.IllegalExpressionException;\nimport org.apache.skywalking.mqe.rt.grammar.MQEParser;\nimport org.apache.skywalking.oap.server.core.query.mqe.ExpressionResult;\nimport org.apache.skywalking.oap.server.core.query.mqe.MQEValue;\nimport org.apache.skywalking.oap.server.core.query.enumeration.Step;\n\npublic class TrendOp {\n    public static ExpressionResult doTrendOp(ExpressionResult expResult,\n                                             int opType,\n                                             int trendRange,\n                                             Step step) throws IllegalExpressionException {\n        switch (opType) {\n            case MQEParser.INCREASE:\n                return TrendOp.calculateIncrease(expResult, trendRange);\n            case MQEParser.RATE:\n                return TrendOp.calculateRate(expResult, trendRange, step);\n        }\n\n        throw new IllegalExpressionException(\"Unsupported function.\");\n    }\n\n    private static ExpressionResult calculateIncrease(ExpressionResult expResult, int trendRange) {\n        expResult.getResults().forEach(resultValues -> {\n            List<MQEValue> mqeValues = resultValues.getValues();\n            List<MQEValue> newMqeValues = new ArrayList<>();\n            for (int i = trendRange; i < mqeValues.size(); i++) {\n                MQEValue mqeValue = mqeValues.get(i);\n                //if the current value is empty, then the trend value is empty\n                if (mqeValue.isEmptyValue()) {\n                    newMqeValues.add(mqeValue);\n                    continue;\n                }\n                MQEValue newMqeValue = new MQEValue();\n                newMqeValue.setId(mqeValue.getId());\n\n                //if the previous value is empty, then the trend value is empty\n                if (mqeValues.get(i - trendRange).isEmptyValue()) {","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/mqe-rt/src/main/java/org/apache/skywalking/mqe/rt/operation/TrendOp.java#L23-L59","documentation":"TrendOp.doTrendOp implements trend functions over series: only increase(...) and rate(...) are dispatched. Any other opType reaching the end of the switch throws 'Unsupported function.' — again a defensive default, since the grammar should only route INCREASE and RATE here.","triggerScenarios":"A trend-function token other than increase/rate dispatched to doTrendOp — realistic only with a custom grammar fork (e.g. adding delta or irate) without a matching runtime case, or with mqe-grammar/mqe-rt version skew in the deployed jars.","commonSituations":"Forked OAP builds with new trend functions; partial upgrades leaving a stale mqe-rt jar; direct programmatic calls to TrendOp.doTrendOp with arbitrary opType constants.","solutions":["Use only increase(metric, range) and rate(metric, range) in MQE expressions","For fork-added trend tokens, implement the case in doTrendOp and rebuild mqe-rt","Deploy matching mqe-grammar and mqe-rt versions","Check the MQE function reference for the supported trend functions in your OAP version"],"exampleFix":"// before\nquery: irate(metric, 5)  // unsupported trend function\n// after\nquery: rate(metric, 5)","handlingStrategy":"try-catch","validationCode":"Set<String> supportedTrend = Set.of(\"increase\", \"rate\");","typeGuard":null,"tryCatchPattern":"catch (IllegalExpressionException e) { /* unsupported trend token — use increase/rate or implement the case */ }","preventionTips":["Use only increase(metric, range) and rate(metric, range)","Keep grammar and runtime jars version-aligned in custom builds"],"tags":["mqe","query-engine","trend","unsupported-operation"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}