[Profile] Visualize the query plan and query profile#5475
[Profile] Visualize the query plan and query profile#5475morningman merged 4 commits intoapache:masterfrom
Conversation
f198ad7 to
0e7cbd2
Compare
|
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. |
Add command: 1. EXPLAIN GRAPGH SELECT ... 2. SHOW QUERY PROFILE "..." Document will be added in next PR Change-Id: Ifd9365e10b1f9ff4fdf8ae0556343783d97545f0
c704929 to
9b54958
Compare
@EmmyMiao87 Done |
| stmt.getQueryStmt().setIsExplain(new ExplainOptions(true, false)); | ||
| RESULT = stmt; | ||
| :} | ||
| ; |
There was a problem hiding this comment.
Change KW_DESCRIBE to KW_EXPLAIN
There was a problem hiding this comment.
KW_DESCRIBE means both "desc" and "explain",
see fe/fe-core/src/main/jflex/sql_scanner.flex
| @@ -36,9 +36,7 @@ public abstract class StatementBase implements ParseNode { | |||
| private String clusterName; | |||
|
|
|||
| // True if this QueryStmt is the top level query from an EXPLAIN <query> | |||
| } | ||
|
|
||
| private void buildForPlanNode(PlanNode planNode, PlanTreeNode parent) { | ||
| StringBuilder sb = new StringBuilder(); |
There was a problem hiding this comment.
Why not print the plan node directly?
| PlanTreeNode sinkNode = null; | ||
| if (sink != null) { | ||
| StringBuilder sb = new StringBuilder(); | ||
| sb.append("[").append(sink.getExchNodeId().asInt()).append(": DATA SINK]"); |
There was a problem hiding this comment.
DATA SINK or Result Sink
There was a problem hiding this comment.
Change to sink's class name
|
|
||
| public class PlanTreeBuilder { | ||
|
|
||
| private static final String EXCHANGE_NODE = "EXCHANGE"; |
There was a problem hiding this comment.
Use final params in Exchange Node.
There was a problem hiding this comment.
Move this to ExchangeNode
| public class PlanTreeBuilder { | ||
|
|
||
| private static final String EXCHANGE_NODE = "EXCHANGE"; | ||
| private static final String MERGING_EXCHANGE_NODE = "MERGING-EXCHANGE"; |
Add command: 1. EXPLAIN GRAPGH SELECT ... 2. SHOW QUERY PROFILE "..." Document will be added in next PR Change-Id: Ifd9365e10b1f9ff4fdf8ae0556343783d97545f0
Proposed changes
Add command:
Document will be added in next PR.
Details can be seem in #5474
Types of changes
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.
Update:
Using tree-printer 1.2 instead of source code
For Reviewer:
The file in package:
fe/fe-common/src/main/java/org/apache/doris/common/treeprinter/are from
davidsusu/tree-printer, no need to review.Add a new statement:
SHOW QUERY PROFILE "/";Files under
fe/fe-core/src/main/java/org/apache/doris/common/profile/are for tree constructionand tree printer.