abhishekagarwal87 commented on a change in pull request #11908:
URL: https://github.com/apache/druid/pull/11908#discussion_r754954301
##########
File path:
sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidPlanner.java
##########
@@ -366,24 +374,76 @@ public void cleanup(EnumeratorIterator<Object[]>
iterFromMake)
*/
private PlannerResult planExplanation(
final RelNode rel,
- final SqlExplain explain
+ final SqlExplain explain,
+ final boolean isDruidConventionExplanation
)
{
- final String explanation = RelOptUtil.dumpPlan("", rel,
explain.getFormat(), explain.getDetailLevel());
+ String explanation = RelOptUtil.dumpPlan("", rel, explain.getFormat(),
explain.getDetailLevel());
String resources;
try {
+ if (isDruidConventionExplanation && rel instanceof DruidRel) {
+ // Show the native queries instead of Calcite's explain if the legacy
flag is turned off
+ if (!plannerContext.getPlannerConfig().isUseLegacyDruidExplain()) {
+ DruidRel<?> druidRel = (DruidRel<?>) rel;
+ explanation = explainSqlPlanAsNativeQueries(druidRel);
+ }
+ }
resources = jsonMapper.writeValueAsString(plannerContext.getResources());
}
catch (JsonProcessingException jpe) {
// this should never happen, we create the Resources here, not a user
log.error(jpe, "Encountered exception while serializing Resources for
explain output");
resources = null;
}
+ catch (ISE ise) {
+ log.error("Unable to translate to a native Druid query. Resorting to
legacy Druid explain plan");
Review comment:
```suggestion
log.error(ise, "Unable to translate to a native Druid query. Resorting
to legacy Druid explain plan");
```
--
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]