walterddr commented on code in PR #11052: URL: https://github.com/apache/pinot/pull/11052#discussion_r1265762959
########## pinot-query-planner/src/main/java/org/apache/pinot/query/QueryEnvironment.java: ########## @@ -185,16 +185,25 @@ public QueryPlannerResult planQuery(String sqlQuery, SqlNodeAndOptions sqlNodeAn * @param sqlNodeAndOptions parsed SQL query. * @return QueryPlannerResult containing the explained query plan and the relRoot. */ - public QueryPlannerResult explainQuery(String sqlQuery, SqlNodeAndOptions sqlNodeAndOptions) { + public QueryPlannerResult explainQuery(String sqlQuery, SqlNodeAndOptions sqlNodeAndOptions, long requestId) { try (PlannerContext plannerContext = new PlannerContext(_config, _catalogReader, _typeFactory, _hepProgram)) { SqlExplain explain = (SqlExplain) sqlNodeAndOptions.getSqlNode(); plannerContext.setOptions(sqlNodeAndOptions.getOptions()); RelRoot relRoot = compileQuery(explain.getExplicandum(), plannerContext); SqlExplainFormat format = explain.getFormat() == null ? SqlExplainFormat.DOT : explain.getFormat(); SqlExplainLevel level = explain.getDetailLevel() == null ? SqlExplainLevel.DIGEST_ATTRIBUTES : explain.getDetailLevel(); - Set<String> tableNames = RelToPlanNodeConverter.getTableNamesFromRelRoot(relRoot.rel); - return new QueryPlannerResult(null, PlannerUtils.explainPlan(relRoot.rel, format, level), tableNames); + boolean showPhysicalPlan = explain.withImplementation(); + String logicalPlan = PlannerUtils.explainPlan(relRoot.rel, format, level); + if (showPhysicalPlan) { + DispatchableSubPlan dispatchableSubPlan = toDispatchableSubPlan(relRoot, plannerContext, requestId); + String physicalPlan = ExplainPlanPlanVisitor.explain(dispatchableSubPlan); + String completePlan = String.format("%s\nPhysical Plan\n %s", logicalPlan, physicalPlan); Review Comment: see the test in https://github.com/apache/calcite/blob/main/core/src/test/java/org/apache/calcite/test/JdbcTest.java ``` with.query("explain plan as json for values (1, 'ab', TIMESTAMP '2013-04-02 00:00:00', 0.01)") .returns(expectedJson); with.query("explain plan with implementation for values (1, 'ab')") .returns("PLAN=EnumerableValues(tuples=[[{ 1, 'ab' }]])\n\n"); with.query("explain plan without implementation for values (1, 'ab')") .returns("PLAN=LogicalValues(tuples=[[{ 1, 'ab' }]])\n\n"); with.query("explain plan with type for values (1, 'ab')") .returns("PLAN=EXPR$0 INTEGER NOT NULL,\n" + "EXPR$1 CHAR(2) NOT NULL\n"); ``` for each enum (TYPE, LOGICAL, PHYSICAL) the result is just the part of the enum e.g. - type is only the result types of each (EXPR$0, EXPR$1) - logical is LogicalValues(...) - physical is EnumerableValues(...) each is not containing the other -- 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...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org