abhioncbr commented on code in PR #11052:
URL: https://github.com/apache/pinot/pull/11052#discussion_r1264708896
##########
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:
Why do we only want the physical plan? IMO, the `with implementation` clause
suggests logical & physical both.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]