From 650316c75d64b091abe6fb8c9f7f6b728571d488 Mon Sep 17 00:00:00 2001 From: Mryange Date: Mon, 18 Nov 2024 15:27:13 +0800 Subject: [PATCH] [fix](profile) only printed for non-sink nodes in the merge profile. (#44040) ### What problem does this PR solve? In the past, the result sink did not have a plan node ID, which led to incorrect plan info being output. Now, the plan info for sinks is not printed. before ``` MergedProfile Fragments: Fragment 0: Pipeline : 0(instance_num=1): - WaitWorkerTime: avg 30.984us, max 30.984us, min 30.984us RESULT_SINK_OPERATOR (id=0): - PlanInfo - TABLE: test.big_string_table(big_string_table), PREAGGREGATION: ON - partitions=1/1 (big_string_table) - tablets=3/3, tabletList=113264,113266,113268 - cardinality=131072, avgRowSize=13.638229, numNodes=1 - pushAggOp=COUNT - projections: 1 - project output tuple id: 1 OLAP_SCAN_OPERATOR (id=0. nereids_id=156. table name = big_string_table(big_string_table)): ``` now ``` MergedProfile Fragments: Fragment 0: Pipeline : 0(instance_num=1): - WaitWorkerTime: avg 32.576us, max 32.576us, min 32.576us RESULT_SINK_OPERATOR (id=0): OLAP_SCAN_OPERATOR (id=0. nereids_id=156. table name = big_string_table(big_string_table)): - PlanInfo - TABLE: test.big_string_table(big_string_table), PREAGGREGATION: ON - partitions=1/1 (big_string_table) - tablets=3/3, tabletList=113264,113266,113268 - cardinality=131072, avgRowSize=0.0, numNodes=1 - pushAggOp=COUNT - projections: 1 - project output tuple id: 1 ``` --- .../apache/doris/common/util/RuntimeProfile.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java b/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java index 3ffc303a6db89d..19082959034156 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java @@ -682,8 +682,17 @@ public void addChildWithCheck(RuntimeProfile child, Map planNod if (planNodeMap == null || !planNodeMap.containsKey(child.nodeId())) { return; } - child.addPlanNodeInfos(planNodeMap.get(child.nodeId())); - planNodeMap.remove(child.nodeId()); + + /* + * The check for SINK_OPERATOR is performed because SINK_OPERATOR does not have + * a corresponding plan node ID. + * Currently, the plan node info is only printed for non-sink nodes in the merge + * profile. + */ + if (name.contains("_SINK_OPERATOR")) { + child.addPlanNodeInfos(planNodeMap.get(child.nodeId())); + planNodeMap.remove(child.nodeId()); + } } public void addPlanNodeInfos(String infos) {