[fix](profile) show query profile for pipeline engine (#15687)

This commit is contained in:
Jerry Hu
2023-01-10 10:12:34 +08:00
committed by GitHub
parent 9c0f96883a
commit c19e391d32

View File

@ -209,7 +209,7 @@ public class ProfileTreeBuilder {
String instanceId) throws UserException {
List<Pair<RuntimeProfile, Boolean>> instanceChildren = instanceProfile.getChildList();
ProfileTreeNode senderNode = null;
ProfileTreeNode execNode = null;
List<ProfileTreeNode> childrenNodes = Lists.newArrayList();
for (Pair<RuntimeProfile, Boolean> 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;
}