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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org