{"record":{"id":"2e94fffb7f5db4fc","repo":"apache/skywalking","slug":"bool-operation-the-result-of-the-right-expression","errorCode":null,"errorMessage":"Bool Operation: The result of the right expression is not a compare result.","messagePattern":"Bool Operation: The result of the right expression is not a compare result\\.","errorType":"exception","errorClass":"IllegalExpressionException","httpStatus":null,"severity":"error","filePath":"oap-server/mqe-rt/src/main/java/org/apache/skywalking/mqe/rt/operation/BoolOp.java","lineNumber":35,"sourceCode":" */\n\npackage org.apache.skywalking.mqe.rt.operation;\n\nimport 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;\n\npublic class BoolOp {\n    public static ExpressionResult doBoolOp(ExpressionResult left,\n                                            ExpressionResult right,\n                                            int opType) throws IllegalExpressionException {\n        if (!checkExpression(left)) {\n            throw new IllegalExpressionException(\n                \"Bool Operation: The result of the left expression is not a compare result.\");\n        }\n\n        if (!checkExpression(right)) {\n            throw new IllegalExpressionException(\n                \"Bool Operation: The result of the right expression is not a compare result.\");\n        }\n\n        try {\n            return LROp.doLROp(left, right, opType, BoolOp::boolOp);\n        } catch (IllegalExpressionException e) {\n            throw new IllegalExpressionException(\"Unsupported bool operation: \" + e.getMessage());\n        }\n    }\n\n    //bool with bool\n    private static double boolOp(double leftValue, double rightValue, int opType) throws IllegalExpressionException {\n        // this should not happen, but just in case\n        if (!checkBool(leftValue)) {\n            throw new IllegalExpressionException(\"Bool Operation: The result of the left expression is not 1 or 0.\");\n        }\n        if (!checkBool(rightValue)) {\n            throw new IllegalExpressionException(\"Bool Operation: The result of the right expression is not 1 or 0.\");","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/mqe-rt/src/main/java/org/apache/skywalking/mqe/rt/operation/BoolOp.java#L17-L53","documentation":"IllegalExpressionException from BoolOp.doBoolOp: symmetric twin of the left-side check — the right operand of && / || has isBoolResult() == false, so it is not the result of a comparison and cannot participate in boolean logic.","triggerScenarios":"'service_sla > 1000 && service_cpm' — the right side is a raw metric value with no comparison, so checkExpression(right) fails before evaluation.","commonSituations":"Same class as the left-side error: truncated boolean chains, dashboard-template generation that drops the trailing comparison, or editing a working condition and deleting the '> N' part.","solutions":["Add the missing comparison to the right operand","Re-read the whole && / || chain and confirm every leaf is of the form 'X <op> Y'","Use the UI MQE preview to validate the boolean expression before saving the dashboard"],"exampleFix":"# before\nservice_sla > 1000 && service_cpm\n# after\nservice_sla > 1000 && service_cpm > 0","handlingStrategy":"validation","validationCode":"boolean isBoolLeaf(ExpressionResult r) { return r.isBoolResult(); } // apply to the right operand too","typeGuard":"boolean isCompareResult(org.apache.skywalking.oap.server.core.query.mqe.ExpressionResult r) {\n    return r.isBoolResult();\n}","tryCatchPattern":null,"preventionTips":["Check the trailing leaf of every && / || chain for a missing comparison","Treat dashboard-template generated conditions with suspicion — verify each leaf"],"tags":["mqe","boolean","compare","query","expression"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}