Skip to content

Commit

Permalink
reserve stats and groupId on rewriting plan node
Browse files Browse the repository at this point in the history
  • Loading branch information
englefly committed Oct 21, 2024
1 parent db55343 commit f14e475
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.doris.nereids.trees.plans.visitor;

import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.physical.AbstractPhysicalPlan;
import org.apache.doris.nereids.trees.plans.physical.PhysicalOlapScan;
import org.apache.doris.nereids.trees.plans.physical.PhysicalStorageLayerAggregate;

Expand Down Expand Up @@ -56,6 +57,15 @@ public static <P extends Plan, C> P visitChildren(DefaultPlanRewriter<C> rewrite
}
newChildren.add(newChild);
}
return hasNewChildren ? (P) plan.withChildren(newChildren.build()) : plan;

if (hasNewChildren) {
plan = (P) plan.withChildren(newChildren.build())
if (plan instanceof AbstractPhysicalPlan) {
AbstractPhysicalPlan physicalPlan = (AbstractPhysicalPlan) plan;
plan = (P) ((AbstractPhysicalPlan)physicalPlan.withChildren(newChildren.build()))
.copyStatsAndGroupIdFrom(physicalPlan);
}
}
return plan;
}
}

0 comments on commit f14e475

Please sign in to comment.