[refactor](nereids) rename PlanNode.distributeExprLists to childrenDistributeExprLists #32069

This commit is contained in:
minghong
2024-03-12 09:50:52 +08:00
committed by yiguolei
parent 194f3432ab
commit da60a111d0
2 changed files with 19 additions and 19 deletions

View File

@ -325,7 +325,7 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
}
DataPartition dataPartition = toDataPartition(distribute.getDistributionSpec(), validOutputIds, context);
exchangeNode.setPartitionType(dataPartition.getType());
exchangeNode.setDistributeExprLists(distributeExprLists);
exchangeNode.setChildrenDistributeExprLists(distributeExprLists);
PlanFragment parentFragment = new PlanFragment(context.nextFragmentId(), exchangeNode, dataPartition);
if (distribute.getDistributionSpec() instanceof DistributionSpecGather) {
// gather to one instance
@ -917,7 +917,7 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
AggregationNode aggregationNode = new AggregationNode(context.nextPlanNodeId(),
inputPlanFragment.getPlanRoot(), aggInfo);
aggregationNode.setDistributeExprLists(distributeExprLists);
aggregationNode.setChildrenDistributeExprLists(distributeExprLists);
aggregationNode.setNereidsId(aggregate.getId());
if (!aggregate.getAggMode().isFinalPhase) {
@ -1017,7 +1017,7 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
AssertNumRowsNode assertNumRowsNode = new AssertNumRowsNode(context.nextPlanNodeId(),
currentFragment.getPlanRoot(),
ExpressionTranslator.translateAssert(assertNumRows.getAssertNumRowsElement()));
assertNumRowsNode.setDistributeExprLists(distributeExprLists);
assertNumRowsNode.setChildrenDistributeExprLists(distributeExprLists);
assertNumRowsNode.setNereidsId(assertNumRows.getId());
addPlanRoot(currentFragment, assertNumRowsNode, assertNumRows);
return currentFragment;
@ -1263,7 +1263,7 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
rightPlanRoot, joinOperator, execEqConjuncts, Lists.newArrayList(), markConjuncts,
null, null, null, hashJoin.isMarkJoin());
hashJoinNode.setNereidsId(hashJoin.getId());
hashJoinNode.setDistributeExprLists(distributeExprLists);
hashJoinNode.setChildrenDistributeExprLists(distributeExprLists);
PlanFragment currentFragment = connectJoinNode(hashJoinNode, leftFragment, rightFragment, context, hashJoin);
if (JoinUtils.shouldColocateJoin(physicalHashJoin)) {
@ -1527,7 +1527,7 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
leftFragmentPlanRoot, rightFragmentPlanRoot, tupleIds, JoinType.toJoinOperator(joinType),
null, null, null, nestedLoopJoin.isMarkJoin());
nestedLoopJoinNode.setNereidsId(nestedLoopJoin.getId());
nestedLoopJoinNode.setDistributeExprLists(distributeExprLists);
nestedLoopJoinNode.setChildrenDistributeExprLists(distributeExprLists);
if (nestedLoopJoin.getStats() != null) {
nestedLoopJoinNode.setCardinality((long) nestedLoopJoin.getStats().getRowCount());
}
@ -1703,7 +1703,7 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
List<List<Expr>> distributeExprLists = getDistributeExprs(partitionTopN.child(0));
PartitionSortNode partitionSortNode = translatePartitionSortNode(
partitionTopN, inputFragment.getPlanRoot(), context);
partitionSortNode.setDistributeExprLists(distributeExprLists);
partitionSortNode.setChildrenDistributeExprLists(distributeExprLists);
addPlanRoot(inputFragment, partitionSortNode, partitionTopN);
// in pipeline engine, we use parallel scan by default, but it broke the rule of data distribution
// we need turn of parallel scan to ensure to get correct result.
@ -1996,7 +1996,7 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
if (!sort.getSortPhase().isMerge()) {
// For localSort or Gather->Sort, we just need to add sortNode
SortNode sortNode = translateSortNode(sort, inputFragment.getPlanRoot(), context);
sortNode.setDistributeExprLists(distributeExprLists);
sortNode.setChildrenDistributeExprLists(distributeExprLists);
addPlanRoot(inputFragment, sortNode, sort);
} else {
// For mergeSort, we need to push sortInfo to exchangeNode
@ -2009,7 +2009,7 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
SortNode sortNode = (SortNode) inputFragment.getPlanRoot().getChild(0);
((ExchangeNode) inputFragment.getPlanRoot()).setMergeInfo(sortNode.getSortInfo());
sortNode.setMergeByExchange();
sortNode.setDistributeExprLists(distributeExprLists);
sortNode.setChildrenDistributeExprLists(distributeExprLists);
}
return inputFragment;
}
@ -2053,7 +2053,7 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
}
}
}
sortNode.setDistributeExprLists(distributeExprLists);
sortNode.setChildrenDistributeExprLists(distributeExprLists);
addPlanRoot(inputFragment, sortNode, topN);
} else {
// For mergeSort, we need to push sortInfo to exchangeNode
@ -2066,7 +2066,7 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
return inputFragment;
}
ExchangeNode exchangeNode = (ExchangeNode) inputFragment.getPlanRoot();
exchangeNode.setDistributeExprLists(distributeExprLists);
exchangeNode.setChildrenDistributeExprLists(distributeExprLists);
exchangeNode.setMergeInfo(((SortNode) exchangeNode.getChild(0)).getSortInfo());
exchangeNode.setLimit(topN.getLimit());
exchangeNode.setOffset(topN.getOffset());
@ -2159,7 +2159,7 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
inputPlanFragment.getPlanRoot(), groupingInfo, repeatSlotIdList,
allSlotId, repeat.computeVirtualSlotValues(sortedVirtualSlots));
repeatNode.setNereidsId(repeat.getId());
repeatNode.setDistributeExprLists(distributeExprLists);
repeatNode.setChildrenDistributeExprLists(distributeExprLists);
addPlanRoot(inputPlanFragment, repeatNode, repeat);
updateLegacyPlanIdToPhysicalPlan(inputPlanFragment.getPlanRoot(), repeat);
return inputPlanFragment;
@ -2246,7 +2246,7 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
bufferedTupleDesc
);
analyticEvalNode.setNereidsId(physicalWindow.getId());
analyticEvalNode.setDistributeExprLists(distributeExprLists);
analyticEvalNode.setChildrenDistributeExprLists(distributeExprLists);
PlanNode root = inputPlanFragment.getPlanRoot();
if (root instanceof SortNode) {
((SortNode) root).setIsAnalyticSort(true);

View File

@ -154,7 +154,7 @@ public abstract class PlanNode extends TreeNode<PlanNode> implements PlanStats {
protected int nereidsId = -1;
private List<List<Expr>> distributeExprLists = new ArrayList<>();
private List<List<Expr>> childrenDistributeExprLists = new ArrayList<>();
protected PlanNode(PlanNodeId id, ArrayList<TupleId> tupleIds, String planNodeName,
StatisticalType statisticalType) {
@ -540,8 +540,8 @@ public abstract class PlanNode extends TreeNode<PlanNode> implements PlanStats {
expBuilder.append(detailPrefix).append("project output tuple id: ")
.append(outputTupleDesc.getId().asInt()).append("\n");
}
if (!CollectionUtils.isEmpty(distributeExprLists)) {
for (List<Expr> distributeExprList : distributeExprLists) {
if (!CollectionUtils.isEmpty(childrenDistributeExprLists)) {
for (List<Expr> distributeExprList : childrenDistributeExprLists) {
expBuilder.append(detailPrefix).append("distribute expr lists: ")
.append(getExplainString(distributeExprList)).append("\n");
}
@ -638,8 +638,8 @@ public abstract class PlanNode extends TreeNode<PlanNode> implements PlanStats {
msg.addToOutputSlotIds(slotId.asInt());
}
}
if (!CollectionUtils.isEmpty(distributeExprLists)) {
for (List<Expr> exprList : distributeExprLists) {
if (!CollectionUtils.isEmpty(childrenDistributeExprLists)) {
for (List<Expr> exprList : childrenDistributeExprLists) {
msg.addToDistributeExprLists(new ArrayList<>());
for (Expr expr : exprList) {
msg.distribute_expr_lists.get(msg.distribute_expr_lists.size() - 1).add(expr.treeToThrift());
@ -1198,8 +1198,8 @@ public abstract class PlanNode extends TreeNode<PlanNode> implements PlanStats {
this.pushDownAggNoGroupingOp = pushDownAggNoGroupingOp;
}
public void setDistributeExprLists(List<List<Expr>> distributeExprLists) {
this.distributeExprLists = distributeExprLists;
public void setChildrenDistributeExprLists(List<List<Expr>> childrenDistributeExprLists) {
this.childrenDistributeExprLists = childrenDistributeExprLists;
}
public TPushAggOp getPushDownAggNoGroupingOp() {