Skip to content

Commit

Permalink
Merge 42e49e8 into 382ce43
Browse files Browse the repository at this point in the history
  • Loading branch information
sujith71955 committed Dec 8, 2018
2 parents 382ce43 + 42e49e8 commit 902a574
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ private static TablePruningInfo getCurrentTablePruningInfo() {
}

public static String getFormatedOutput() {
return get().toString();
if (null != get()) {
return get().toString();
} else {
return null;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ case class CarbonExplainCommand(
}

private def collectProfiler(sparkSession: SparkSession): Seq[Row] = {
val queryExecution =
sparkSession.sessionState.executePlan(child.asInstanceOf[ExplainCommand].logicalPlan)
try {
ExplainCollector.setup()
queryExecution.toRdd.partitions
if (ExplainCollector.enabled()) {
val queryExecution =
sparkSession.sessionState.executePlan(child.asInstanceOf[ExplainCommand].logicalPlan)
queryExecution.toRdd.partitions
// For count(*) queries the explain collector will be disabled, so profiler
// informations not required in such scenarios.
if (null == ExplainCollector.getFormatedOutput) {
Seq.empty
}
Seq(Row("== CarbonData Profiler ==\n" + ExplainCollector.getFormatedOutput))
} else {
Seq.empty
Expand Down

0 comments on commit 902a574

Please sign in to comment.