diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnBE.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnBE.java index 3c2f0d546dd04a..e0e19bd19e2b06 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnBE.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnBE.java @@ -215,6 +215,11 @@ private static void collectConst(Expression expr, Map constM LOG.warn("expression {} translate to legacy expr failed. ", expr, e); return; } + if (staleExpr == null) { + // just return, it's a fail-safe + LOG.warn("expression {} translate to legacy expr failed. ", expr); + return; + } tExprMap.put(id, staleExpr.treeToThrift()); } else { for (int i = 0; i < expr.children().size(); i++) {