[fix](Nereids) colcoate node attr lost after merge fragment (#30818)

This commit is contained in:
morrySnow
2024-02-05 14:42:09 +08:00
committed by yiguolei
parent 255ca143f8
commit 3a752b758a
7 changed files with 288 additions and 2 deletions

View File

@ -212,9 +212,17 @@ public class PlanTranslatorContext {
exprIdToColumnRef.put(exprId, columnRefExpr);
}
/**
* merge source fragment info into target fragment.
* include runtime filter info and fragment attribute.
*/
public void mergePlanFragment(PlanFragment srcFragment, PlanFragment targetFragment) {
srcFragment.getTargetRuntimeFilterIds().forEach(targetFragment::setTargetRuntimeFilterIds);
srcFragment.getBuilderRuntimeFilterIds().forEach(targetFragment::setBuilderRuntimeFilterIds);
targetFragment.setHasColocatePlanNode(targetFragment.hasColocatePlanNode()
|| srcFragment.hasColocatePlanNode());
targetFragment.setHasNullAwareLeftAntiJoin(targetFragment.isHasNullAwareLeftAntiJoin()
|| srcFragment.isHasNullAwareLeftAntiJoin());
this.planFragments.remove(srcFragment);
}

View File

@ -31,6 +31,8 @@ public class MultiCastPlanFragment extends PlanFragment {
public MultiCastPlanFragment(PlanFragment planFragment) {
super(planFragment.getFragmentId(), planFragment.getPlanRoot(), planFragment.getDataPartition(),
planFragment.getBuilderRuntimeFilterIds(), planFragment.getTargetRuntimeFilterIds());
this.hasColocatePlanNode = planFragment.hasColocatePlanNode;
this.hasNullAwareLeftAntiJoin = planFragment.hasNullAwareLeftAntiJoin;
this.outputPartition = DataPartition.RANDOM;
this.children.addAll(planFragment.getChildren());
}

View File

@ -147,9 +147,9 @@ public class PlanFragment extends TreeNode<PlanFragment> {
private int bucketNum;
// has colocate plan node
private boolean hasColocatePlanNode = false;
protected boolean hasColocatePlanNode = false;
private boolean hasNullAwareLeftAntiJoin = false;
protected boolean hasNullAwareLeftAntiJoin = false;
private TResultSinkType resultSinkType = TResultSinkType.MYSQL_PROTOCAL;