apache/skywalking · error · IllegalExpressionException
Unsupported function.
Error message
Unsupported function.
What it means
MathematicalFunctionOp.doFunction0Op handles zero-argument scalar math functions over an ExpressionResult: only abs, ceil, and floor are implemented. Any other token type reaching the switch throws 'Unsupported function.'. Like error 93, the ANTLR grammar normally prevents other tokens from reaching here, so this is a defensive default guarding grammar/runtime version mismatch.
Source
Thrown at oap-server/mqe-rt/src/main/java/org/apache/skywalking/mqe/rt/operation/MathematicalFunctionOp.java:40
import java.math.RoundingMode;
import java.util.function.Function;
import org.apache.skywalking.mqe.rt.exception.IllegalExpressionException;
import org.apache.skywalking.mqe.rt.grammar.MQEParser;
import org.apache.skywalking.oap.server.core.query.mqe.ExpressionResult;
public class MathematicalFunctionOp {
public static ExpressionResult doFunction0Op(ExpressionResult expResult,
int opType) throws IllegalExpressionException {
switch (opType) {
case MQEParser.ABS:
return MathematicalFunctionOp.transResult(expResult, Math::abs);
case MQEParser.CEIL:
return MathematicalFunctionOp.transResult(expResult, Math::ceil);
case MQEParser.FLOOR:
return MathematicalFunctionOp.transResult(expResult, Math::floor);
}
throw new IllegalExpressionException("Unsupported function.");
}
public static ExpressionResult doFunction1Op(ExpressionResult expResult,
int opType,
int scale) throws IllegalExpressionException {
switch (opType) {
case MQEParser.ROUND:
return MathematicalFunctionOp.transResult(expResult, aDouble -> {
BigDecimal bd = BigDecimal.valueOf(aDouble);
return bd.setScale(scale, RoundingMode.HALF_UP).doubleValue();
});
}
throw new IllegalExpressionException("Unsupported function.");
}
private static ExpressionResult transResult(ExpressionResult expResult, Function<Double, Double> calculator) {
expResult.getResults().forEach(resultValues -> {View on GitHub (pinned to 102af09b4a)
Solutions
- Restrict queries to the supported set: abs(...), ceil(...), floor(...) (and round(...) with scale, handled by doFunction1Op)
- If you added a grammar token, implement its case in doFunction0Op/doFunction1Op and rebuild
- Verify mqe-grammar and mqe-rt jars in the deployment are the same version
- Re-run the simplest failing expression to confirm which token is unsupported
Example fix
// before query: sqrt(metric) // not supported by this OAP // after query: abs(metric)
Defensive patterns
Strategy: try-catch
Validate before calling
Set<String> supportedFn0 = Set.of("abs", "ceil", "floor");
if (!supportedFn0.contains(fnName)) throw new IllegalArgumentException("unsupported: " + fnName); Try / catch
catch (IllegalExpressionException e) { /* unsupported zero-arg math function — check function list for your OAP version */ } Prevention
- Restrict queries to abs/ceil/floor/round
- Never mix parser and runtime jars from different OAP builds
When it happens
Trigger: An MQE expression invoking a function token that resolves to neither ABS, CEIL nor FLOOR in the doFunction0Op dispatch — e.g. a forked grammar token, or a mqe-rt jar older than the mqe-grammar jar that parsed the query.
Common situations: Custom OAP builds with new math functions added to the grammar but not the runtime; mixed-version jars after a partial upgrade; a hand-edited or generated visitor passing the wrong opType constant.
Related errors
- Unsupported function.
- Unsupported sort order.
- Unsupported function.
- Unsupported aggregateLabels function.
- Unsupported aggregation operation.
AI-assisted analysis of apache/skywalking@102af09b4a (2026-08-14).
Data as JSON: /api/errors/1197cb0b69241b2c.
Report an issue: GitHub.