You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/03/06 02:13:40 UTC

[GitHub] [incubator-doris] morningman opened a new pull request #5475: [Profile] Visualize the query plan and query profile

morningman opened a new pull request #5475:
URL: https://github.com/apache/incubator-doris/pull/5475


   ## Proposed changes
   
   Add command:
   1. EXPLAIN GRAPGH SELECT ...
   2. SHOW QUERY PROFILE "..."
   
   Document will be added in next PR.
   Details can be seem in #5474 
   
   ## Types of changes
   
   - [x] New feature (non-breaking change which adds functionality)
   
   ## Other
   
   I introduced a tree printer class from https://github.com/davidsusu/tree-printer
   This is a greet tree printer, but it release version has a NPE bug.
   So I can't just add maven dependency of it, but has to add all its source codes in
   our repo and fix the bug.
   
   I will also send a PR to `davidsusu/tree-printer`, and once it merged and release a new version.
   I will remove the source code of the tree printer in Doris and use its maven dependency.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] morningman commented on a change in pull request #5475: [Profile] Visualize the query plan and query profile

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #5475:
URL: https://github.com/apache/incubator-doris/pull/5475#discussion_r595647443



##########
File path: fe/fe-core/src/main/java/org/apache/doris/common/profile/PlanTreeBuilder.java
##########
@@ -0,0 +1,127 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.common.profile;
+
+import org.apache.doris.common.UserException;
+import org.apache.doris.planner.DataSink;
+import org.apache.doris.planner.PlanFragment;
+import org.apache.doris.planner.PlanNode;
+import org.apache.doris.planner.PlanNodeId;
+import org.apache.doris.thrift.TExplainLevel;
+
+import com.clearspring.analytics.util.Lists;
+
+import java.util.List;
+
+public class PlanTreeBuilder {
+
+    private static final String EXCHANGE_NODE = "EXCHANGE";
+    private static final String MERGING_EXCHANGE_NODE = "MERGING-EXCHANGE";
+
+    private List<PlanFragment> fragments;
+    private PlanTreeNode treeRoot;
+    private List<PlanTreeNode> sinkNodes = Lists.newArrayList();
+    private List<PlanTreeNode> exchangeNodes = Lists.newArrayList();
+
+    public PlanTreeBuilder(List<PlanFragment> fragments) {
+        this.fragments = fragments;
+    }
+
+    public PlanTreeNode getTreeRoot() {
+        return treeRoot;
+    }
+
+    public void build() throws UserException {
+        buildFragmentPlans();
+        assembleFragmentPlans();
+    }
+
+    private void buildFragmentPlans() {
+        int i = 0;
+        for (PlanFragment fragment : fragments) {
+            DataSink sink = fragment.getSink();
+            PlanTreeNode sinkNode = null;
+            if (sink != null) {
+                StringBuilder sb = new StringBuilder();
+                sb.append("[").append(sink.getExchNodeId().asInt()).append(": DATA SINK]");
+                sb.append("\nFragment: ").append(fragment.getId().asInt());
+                sb.append("\n").append(sink.getExplainString("", TExplainLevel.BRIEF));
+                sinkNode = new PlanTreeNode(sink.getExchNodeId(), sb.toString());
+                if (i == 0) {
+                    // sink of first fragment, set it as tree root
+                    treeRoot = sinkNode;
+                } else {
+                    sinkNodes.add(sinkNode);
+                }
+            }
+
+            PlanNode planRoot = fragment.getPlanRoot();
+            if (planRoot != null) {
+                buildForPlanNode(planRoot, sinkNode);
+            }
+            i++;
+        }
+    }
+
+    private void assembleFragmentPlans() throws UserException {
+        for (PlanTreeNode sender : sinkNodes) {
+            if (sender == treeRoot) {
+                // This is the result sink, skip it
+                continue;
+            }
+            PlanNodeId senderId = sender.getId();
+            PlanTreeNode exchangeNode = findExchangeNode(senderId);
+            if (exchangeNode == null) {
+                throw new UserException("Failed to find exchange node for sender id: " + senderId.asInt());
+            }
+
+            exchangeNode.addChild(sender);
+        }
+    }
+
+    private PlanTreeNode findExchangeNode(PlanNodeId senderId) {
+        for (PlanTreeNode exchangeNode : exchangeNodes) {
+            if (exchangeNode.getId().equals(senderId)) {
+                return exchangeNode;
+            }
+        }
+        return null;
+    }
+
+    private void buildForPlanNode(PlanNode planNode, PlanTreeNode parent) {
+        StringBuilder sb = new StringBuilder();

Review comment:
       ok




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] morningman commented on pull request #5475: [Profile] Visualize the query plan and query profile

Posted by GitBox <gi...@apache.org>.
morningman commented on pull request #5475:
URL: https://github.com/apache/incubator-doris/pull/5475#issuecomment-794763012


   > Can't his tool directly reference jar? Do we have to buckle the code into our own code base?
   
   OK, I will wait it to make to new release.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] morningman commented on a change in pull request #5475: [Profile] Visualize the query plan and query profile

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #5475:
URL: https://github.com/apache/incubator-doris/pull/5475#discussion_r595647486



##########
File path: fe/fe-core/src/main/java/org/apache/doris/common/profile/PlanTreeBuilder.java
##########
@@ -0,0 +1,127 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.common.profile;
+
+import org.apache.doris.common.UserException;
+import org.apache.doris.planner.DataSink;
+import org.apache.doris.planner.PlanFragment;
+import org.apache.doris.planner.PlanNode;
+import org.apache.doris.planner.PlanNodeId;
+import org.apache.doris.thrift.TExplainLevel;
+
+import com.clearspring.analytics.util.Lists;
+
+import java.util.List;
+
+public class PlanTreeBuilder {
+
+    private static final String EXCHANGE_NODE = "EXCHANGE";
+    private static final String MERGING_EXCHANGE_NODE = "MERGING-EXCHANGE";
+
+    private List<PlanFragment> fragments;
+    private PlanTreeNode treeRoot;
+    private List<PlanTreeNode> sinkNodes = Lists.newArrayList();
+    private List<PlanTreeNode> exchangeNodes = Lists.newArrayList();
+
+    public PlanTreeBuilder(List<PlanFragment> fragments) {
+        this.fragments = fragments;
+    }
+
+    public PlanTreeNode getTreeRoot() {
+        return treeRoot;
+    }
+
+    public void build() throws UserException {
+        buildFragmentPlans();
+        assembleFragmentPlans();
+    }
+
+    private void buildFragmentPlans() {
+        int i = 0;
+        for (PlanFragment fragment : fragments) {
+            DataSink sink = fragment.getSink();
+            PlanTreeNode sinkNode = null;
+            if (sink != null) {
+                StringBuilder sb = new StringBuilder();
+                sb.append("[").append(sink.getExchNodeId().asInt()).append(": DATA SINK]");

Review comment:
       Change to sink's class name




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] morningman commented on pull request #5475: [Profile] Visualize the query plan and query profile

Posted by GitBox <gi...@apache.org>.
morningman commented on pull request #5475:
URL: https://github.com/apache/incubator-doris/pull/5475#issuecomment-796801696


   > > Can't his tool directly reference jar? Do we have to buckle the code into our own code base?
   > 
   > OK, I will wait it to make to new release.
   
   @EmmyMiao87 Done


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] morningman commented on a change in pull request #5475: [Profile] Visualize the query plan and query profile

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #5475:
URL: https://github.com/apache/incubator-doris/pull/5475#discussion_r595648452



##########
File path: fe/fe-core/src/main/java/org/apache/doris/common/profile/PlanTreeBuilder.java
##########
@@ -0,0 +1,127 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.common.profile;
+
+import org.apache.doris.common.UserException;
+import org.apache.doris.planner.DataSink;
+import org.apache.doris.planner.PlanFragment;
+import org.apache.doris.planner.PlanNode;
+import org.apache.doris.planner.PlanNodeId;
+import org.apache.doris.thrift.TExplainLevel;
+
+import com.clearspring.analytics.util.Lists;
+
+import java.util.List;
+
+public class PlanTreeBuilder {
+
+    private static final String EXCHANGE_NODE = "EXCHANGE";

Review comment:
       Move this to ExchangeNode

##########
File path: fe/fe-core/src/main/java/org/apache/doris/common/profile/PlanTreeBuilder.java
##########
@@ -0,0 +1,127 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.common.profile;
+
+import org.apache.doris.common.UserException;
+import org.apache.doris.planner.DataSink;
+import org.apache.doris.planner.PlanFragment;
+import org.apache.doris.planner.PlanNode;
+import org.apache.doris.planner.PlanNodeId;
+import org.apache.doris.thrift.TExplainLevel;
+
+import com.clearspring.analytics.util.Lists;
+
+import java.util.List;
+
+public class PlanTreeBuilder {
+
+    private static final String EXCHANGE_NODE = "EXCHANGE";
+    private static final String MERGING_EXCHANGE_NODE = "MERGING-EXCHANGE";

Review comment:
       Done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] EmmyMiao87 commented on a change in pull request #5475: [Profile] Visualize the query plan and query profile

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 commented on a change in pull request #5475:
URL: https://github.com/apache/incubator-doris/pull/5475#discussion_r594256107



##########
File path: fe/fe-core/src/main/cup/sql_parser.cup
##########
@@ -2653,14 +2661,14 @@ describe_stmt ::=
     {:
         RESULT = new DescribeStmt(table, true);
     :}
-    | describe_command opt_verbose:isVerbose query_stmt:query
+    | describe_command opt_explain_options:options query_stmt:query
     {:
-        query.setIsExplain(true, isVerbose);
+        query.setIsExplain(options);
         RESULT = query;
     :}   
     | describe_command insert_stmt:stmt
     {:
-        stmt.getQueryStmt().setIsExplain(true);
+        stmt.getQueryStmt().setIsExplain(new ExplainOptions(true, false));
         RESULT = stmt;
     :}
     ;

Review comment:
       Change ```KW_DESCRIBE``` to ```KW_EXPLAIN```

##########
File path: fe/fe-core/src/main/java/org/apache/doris/analysis/StatementBase.java
##########
@@ -36,9 +36,7 @@
     private String clusterName;
 
     // True if this QueryStmt is the top level query from an EXPLAIN <query>

Review comment:
       Please update comment.

##########
File path: fe/fe-core/src/main/java/org/apache/doris/common/profile/PlanTreeBuilder.java
##########
@@ -0,0 +1,127 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.common.profile;
+
+import org.apache.doris.common.UserException;
+import org.apache.doris.planner.DataSink;
+import org.apache.doris.planner.PlanFragment;
+import org.apache.doris.planner.PlanNode;
+import org.apache.doris.planner.PlanNodeId;
+import org.apache.doris.thrift.TExplainLevel;
+
+import com.clearspring.analytics.util.Lists;
+
+import java.util.List;
+
+public class PlanTreeBuilder {
+
+    private static final String EXCHANGE_NODE = "EXCHANGE";
+    private static final String MERGING_EXCHANGE_NODE = "MERGING-EXCHANGE";
+
+    private List<PlanFragment> fragments;
+    private PlanTreeNode treeRoot;
+    private List<PlanTreeNode> sinkNodes = Lists.newArrayList();
+    private List<PlanTreeNode> exchangeNodes = Lists.newArrayList();
+
+    public PlanTreeBuilder(List<PlanFragment> fragments) {
+        this.fragments = fragments;
+    }
+
+    public PlanTreeNode getTreeRoot() {
+        return treeRoot;
+    }
+
+    public void build() throws UserException {
+        buildFragmentPlans();
+        assembleFragmentPlans();
+    }
+
+    private void buildFragmentPlans() {
+        int i = 0;
+        for (PlanFragment fragment : fragments) {
+            DataSink sink = fragment.getSink();
+            PlanTreeNode sinkNode = null;
+            if (sink != null) {
+                StringBuilder sb = new StringBuilder();
+                sb.append("[").append(sink.getExchNodeId().asInt()).append(": DATA SINK]");
+                sb.append("\nFragment: ").append(fragment.getId().asInt());
+                sb.append("\n").append(sink.getExplainString("", TExplainLevel.BRIEF));
+                sinkNode = new PlanTreeNode(sink.getExchNodeId(), sb.toString());
+                if (i == 0) {
+                    // sink of first fragment, set it as tree root
+                    treeRoot = sinkNode;
+                } else {
+                    sinkNodes.add(sinkNode);
+                }
+            }
+
+            PlanNode planRoot = fragment.getPlanRoot();
+            if (planRoot != null) {
+                buildForPlanNode(planRoot, sinkNode);
+            }
+            i++;
+        }
+    }
+
+    private void assembleFragmentPlans() throws UserException {
+        for (PlanTreeNode sender : sinkNodes) {
+            if (sender == treeRoot) {
+                // This is the result sink, skip it
+                continue;
+            }
+            PlanNodeId senderId = sender.getId();
+            PlanTreeNode exchangeNode = findExchangeNode(senderId);
+            if (exchangeNode == null) {
+                throw new UserException("Failed to find exchange node for sender id: " + senderId.asInt());
+            }
+
+            exchangeNode.addChild(sender);
+        }
+    }
+
+    private PlanTreeNode findExchangeNode(PlanNodeId senderId) {
+        for (PlanTreeNode exchangeNode : exchangeNodes) {
+            if (exchangeNode.getId().equals(senderId)) {
+                return exchangeNode;
+            }
+        }
+        return null;
+    }
+
+    private void buildForPlanNode(PlanNode planNode, PlanTreeNode parent) {
+        StringBuilder sb = new StringBuilder();

Review comment:
       Why not print the plan node directly?

##########
File path: fe/fe-core/src/main/java/org/apache/doris/common/profile/PlanTreeBuilder.java
##########
@@ -0,0 +1,127 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.common.profile;
+
+import org.apache.doris.common.UserException;
+import org.apache.doris.planner.DataSink;
+import org.apache.doris.planner.PlanFragment;
+import org.apache.doris.planner.PlanNode;
+import org.apache.doris.planner.PlanNodeId;
+import org.apache.doris.thrift.TExplainLevel;
+
+import com.clearspring.analytics.util.Lists;
+
+import java.util.List;
+
+public class PlanTreeBuilder {
+
+    private static final String EXCHANGE_NODE = "EXCHANGE";
+    private static final String MERGING_EXCHANGE_NODE = "MERGING-EXCHANGE";

Review comment:
       Same as above

##########
File path: fe/fe-core/src/main/java/org/apache/doris/common/profile/PlanTreeBuilder.java
##########
@@ -0,0 +1,127 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.common.profile;
+
+import org.apache.doris.common.UserException;
+import org.apache.doris.planner.DataSink;
+import org.apache.doris.planner.PlanFragment;
+import org.apache.doris.planner.PlanNode;
+import org.apache.doris.planner.PlanNodeId;
+import org.apache.doris.thrift.TExplainLevel;
+
+import com.clearspring.analytics.util.Lists;
+
+import java.util.List;
+
+public class PlanTreeBuilder {
+
+    private static final String EXCHANGE_NODE = "EXCHANGE";
+    private static final String MERGING_EXCHANGE_NODE = "MERGING-EXCHANGE";
+
+    private List<PlanFragment> fragments;
+    private PlanTreeNode treeRoot;
+    private List<PlanTreeNode> sinkNodes = Lists.newArrayList();
+    private List<PlanTreeNode> exchangeNodes = Lists.newArrayList();
+
+    public PlanTreeBuilder(List<PlanFragment> fragments) {
+        this.fragments = fragments;
+    }
+
+    public PlanTreeNode getTreeRoot() {
+        return treeRoot;
+    }
+
+    public void build() throws UserException {
+        buildFragmentPlans();
+        assembleFragmentPlans();
+    }
+
+    private void buildFragmentPlans() {
+        int i = 0;
+        for (PlanFragment fragment : fragments) {
+            DataSink sink = fragment.getSink();
+            PlanTreeNode sinkNode = null;
+            if (sink != null) {
+                StringBuilder sb = new StringBuilder();
+                sb.append("[").append(sink.getExchNodeId().asInt()).append(": DATA SINK]");

Review comment:
       DATA SINK or Result Sink

##########
File path: fe/fe-core/src/main/java/org/apache/doris/common/profile/PlanTreeBuilder.java
##########
@@ -0,0 +1,127 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.common.profile;
+
+import org.apache.doris.common.UserException;
+import org.apache.doris.planner.DataSink;
+import org.apache.doris.planner.PlanFragment;
+import org.apache.doris.planner.PlanNode;
+import org.apache.doris.planner.PlanNodeId;
+import org.apache.doris.thrift.TExplainLevel;
+
+import com.clearspring.analytics.util.Lists;
+
+import java.util.List;
+
+public class PlanTreeBuilder {
+
+    private static final String EXCHANGE_NODE = "EXCHANGE";

Review comment:
       Use final params in Exchange Node.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] morningman commented on a change in pull request #5475: [Profile] Visualize the query plan and query profile

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #5475:
URL: https://github.com/apache/incubator-doris/pull/5475#discussion_r595644698



##########
File path: fe/fe-core/src/main/java/org/apache/doris/analysis/StatementBase.java
##########
@@ -36,9 +36,7 @@
     private String clusterName;
 
     // True if this QueryStmt is the top level query from an EXPLAIN <query>

Review comment:
       ok




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] morningman commented on a change in pull request #5475: [Profile] Visualize the query plan and query profile

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #5475:
URL: https://github.com/apache/incubator-doris/pull/5475#discussion_r595644429



##########
File path: fe/fe-core/src/main/cup/sql_parser.cup
##########
@@ -2653,14 +2661,14 @@ describe_stmt ::=
     {:
         RESULT = new DescribeStmt(table, true);
     :}
-    | describe_command opt_verbose:isVerbose query_stmt:query
+    | describe_command opt_explain_options:options query_stmt:query
     {:
-        query.setIsExplain(true, isVerbose);
+        query.setIsExplain(options);
         RESULT = query;
     :}   
     | describe_command insert_stmt:stmt
     {:
-        stmt.getQueryStmt().setIsExplain(true);
+        stmt.getQueryStmt().setIsExplain(new ExplainOptions(true, false));
         RESULT = stmt;
     :}
     ;

Review comment:
       KW_DESCRIBE means both "desc" and "explain",
   see `fe/fe-core/src/main/jflex/sql_scanner.flex`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] morningman merged pull request #5475: [Profile] Visualize the query plan and query profile

Posted by GitBox <gi...@apache.org>.
morningman merged pull request #5475:
URL: https://github.com/apache/incubator-doris/pull/5475


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] EmmyMiao87 commented on pull request #5475: [Profile] Visualize the query plan and query profile

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 commented on pull request #5475:
URL: https://github.com/apache/incubator-doris/pull/5475#issuecomment-794760856


   Can't his tool directly reference jar? Do we have to buckle the code into our own code base?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org