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 2022/07/27 07:19:48 UTC

[GitHub] [doris] wangshuo128 commented on a diff in pull request #11210: [enhancement](Nereids)enable explain query for nereids planner

wangshuo128 commented on code in PR #11210:
URL: https://github.com/apache/doris/pull/11210#discussion_r930703991


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/NereidsParser.java:
##########
@@ -46,14 +49,25 @@ public class NereidsParser {
      * a single packet.
      * https://dev.mysql.com/doc/internals/en/com-set-option.html
      */
-    public List<StatementBase> parseSQL(String originStr) throws Exception {
-        List<LogicalPlan> logicalPlanList = parseMultiple(originStr);
-        List<StatementBase> statementBaseList = new ArrayList<>();
-        for (LogicalPlan logicalPlan : logicalPlanList) {
+    public List<StatementBase> parseSQL(String originStr) {
+        List<LogicalPlan> logicalPlans = parseMultiple(originStr);
+        List<StatementBase> statementBases = new ArrayList<>();
+        for (LogicalPlan logicalPlan : logicalPlans) {
+            // TODO: this is a trick to support explain. Since we do not support any other command in a short time.
+            //     It is acceptable. In the future, we need to refactor this.
+            ExplainOptions explainOptions = null;
+            if (logicalPlan instanceof ExplainCommand) {

Review Comment:
   I think it's clear like this:
   ```java
               if (logicalPlan instanceof ExplainCommand) {
                   ExplainCommand explainCommand = (ExplainCommand) logicalPlan;
                   LogicalPlan innerPlan = explainCommand.getLogicalPlan();
                   LogicalPlanAdapter logicalPlanAdapter = new LogicalPlanAdapter(innerPlan);
                   logicalPlanAdapter.setIsExplain(new ExplainOptions(
                           explainCommand.getLevel() == ExplainLevel.VERBOSE,
                           explainCommand.getLevel() == ExplainLevel.GRAPH));
                   statementBases.add(logicalPlanAdapter);
               } else {
                   statementBases.add(new LogicalPlanAdapter(logicalPlan));
               }
   ```



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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