[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
This commit is contained in:
morrySnow
2024-04-29 19:33:48 +08:00
committed by yiguolei
parent 9d0d7293f0
commit a391cf6bfe

View File

@ -204,9 +204,8 @@ public class MaterializedViewUtils {
CascadesContext cascadesContext,
Function<CascadesContext, Plan> planRewriter,
Plan rewrittenPlan, Plan originPlan) {
List<Slot> 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