Skip to content

Commit

Permalink
[fix](nereids)reserve stats and groupId on rewriting plan node (apach…
Browse files Browse the repository at this point in the history
…e#42140)

## Proposed changes
when node is rewriten, stats and group Id is removed
this pr try to keep them
Issue Number: close #xxx

<!--Describe your changes.-->
  • Loading branch information
englefly authored Oct 22, 2024
1 parent 6d23af2 commit cd5f9d7
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 cd5f9d7

Please sign in to comment.