diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java index bdbc1ba57b740f..b6b09348046cea 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java @@ -712,9 +712,10 @@ public String getExplainString(ExplainOptions explainOptions) { + rewrittenPlan.treeString() + "\n\n" + "========== OPTIMIZED PLAN " + getTimeMetricString(SummaryProfile::getPrettyNereidsOptimizeTime) + " ==========\n" - + optimizedPlan.treeString() + "\n\n" - + "========== MEMO " - + cascadesContext.getMemo().toString() + "\n\n"; + + optimizedPlan.treeString() + "\n\n"; + if (cascadesContext != null && cascadesContext.getMemo() != null) { + plan += "========== MEMO " + cascadesContext.getMemo().toString() + "\n\n"; + } if (distributedPlans != null && !distributedPlans.isEmpty()) { plan += "========== DISTRIBUTED PLAN "