From c19e391d328fc23986bfeb0ee985c3a94fba2bdb Mon Sep 17 00:00:00 2001 From: Jerry Hu Date: Tue, 10 Jan 2023 10:12:34 +0800 Subject: [PATCH] [fix](profile) show query profile for pipeline engine (#15687) --- .../common/profile/ProfileTreeBuilder.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/profile/ProfileTreeBuilder.java b/fe/fe-core/src/main/java/org/apache/doris/common/profile/ProfileTreeBuilder.java index bb5d661d68..e2bea7e39c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/profile/ProfileTreeBuilder.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/profile/ProfileTreeBuilder.java @@ -209,7 +209,7 @@ public class ProfileTreeBuilder { String instanceId) throws UserException { List> instanceChildren = instanceProfile.getChildList(); ProfileTreeNode senderNode = null; - ProfileTreeNode execNode = null; + List childrenNodes = Lists.newArrayList(); for (Pair pair : instanceChildren) { RuntimeProfile profile = pair.first; if (profile.getName().startsWith(PROFILE_NAME_DATA_STREAM_SENDER) @@ -227,10 +227,10 @@ public class ProfileTreeBuilder { continue; } else { // This should be an ExecNode profile - execNode = buildTreeNode(profile, null, fragmentId, instanceId); + childrenNodes.add(buildTreeNode(profile, null, fragmentId, instanceId)); } } - if (senderNode == null || execNode == null) { + if (senderNode == null || childrenNodes.isEmpty()) { // FE will constantly update the total profile after receiving the instance profile reported by BE. // Writing a profile will result in an empty instance profile until all instance profiles are received // at least once. @@ -238,16 +238,20 @@ public class ProfileTreeBuilder { StringBuilder sb = new StringBuilder(); instanceProfile.prettyPrint(sb, ""); if (LOG.isDebugEnabled()) { - LOG.debug("Invalid instance profile, sender is null: {}, execNode is null: {}, instance profile: {}", - (senderNode == null), (execNode == null), sb.toString()); + LOG.debug( + "Invalid instance profile, sender is null: {}," + + "childrenNodes is empty: {}, instance profile: {}", + (senderNode == null), childrenNodes.isEmpty(), sb.toString()); } throw new UserException("Invalid instance profile, without sender or exec node: " + instanceProfile); } - senderNode.addChild(execNode); - execNode.setParentNode(senderNode); + for (ProfileTreeNode execNode : childrenNodes) { + senderNode.addChild(execNode); + execNode.setParentNode(senderNode); + execNode.setFragmentAndInstanceId(fragmentId, instanceId); + } senderNode.setFragmentAndInstanceId(fragmentId, instanceId); - execNode.setFragmentAndInstanceId(fragmentId, instanceId); return senderNode; }