From a391cf6bfe6281bb44ee301e399bed7990aa304a Mon Sep 17 00:00:00 2001 From: morrySnow <101034200+morrySnow@users.noreply.github.com> Date: Mon, 29 Apr 2024 19:33:48 +0800 Subject: [PATCH] [fix](Nereids) rewritten mv should check output set and should not return null (#34288) 1. we should check output set, since we will remove top project and result output size will diff with its child output size if there are dup slot in result list 2. should not return null, instead we should return rewritten plan itself, because we will use return result in many place and do not check null at all --- .../nereids/rules/exploration/mv/MaterializedViewUtils.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java index 73029b4ec1..0fbcf6b7d6 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java @@ -204,9 +204,8 @@ public class MaterializedViewUtils { CascadesContext cascadesContext, Function planRewriter, Plan rewrittenPlan, Plan originPlan) { - List originOutputs = originPlan.getOutput(); - if (originOutputs.size() != rewrittenPlan.getOutput().size()) { - return null; + if (originPlan.getOutputSet().size() != rewrittenPlan.getOutputSet().size()) { + return rewrittenPlan; } // After RBO, slot order may change, so need originSlotToRewrittenExprId which record // origin plan slot order