[SPARK-30148][SQL] Optimize writing plans if there is an analysis exception
### What changes were proposed in this pull request? Optimized QueryExecution.scala#writePlans(). ### Why are the changes needed? If any query fails in Analysis phase and gets AnalysisException, there is no need to execute further phases since those will return a same result i.e, AnalysisException. ### Does this PR introduce any user-facing change? No ### How was this patch tested? Manually Closes #26778 from amanomer/optExplain. Authored-by: Aman Omer <amanomer1996@gmail.com> Signed-off-by: HyukjinKwon <gurwls223@apache.org>
This commit is contained in:
parent
a30ec19a73
commit
51aa7a920e
|
@ -143,14 +143,14 @@ class QueryExecution(
|
||||||
analyzed.output.map(o => s"${o.name}: ${o.dataType.simpleString}"), ", ", maxFields)
|
analyzed.output.map(o => s"${o.name}: ${o.dataType.simpleString}"), ", ", maxFields)
|
||||||
)
|
)
|
||||||
append("\n")
|
append("\n")
|
||||||
|
QueryPlan.append(analyzed, append, verbose, addSuffix, maxFields)
|
||||||
|
append("\n== Optimized Logical Plan ==\n")
|
||||||
|
QueryPlan.append(optimizedPlan, append, verbose, addSuffix, maxFields)
|
||||||
|
append("\n== Physical Plan ==\n")
|
||||||
|
QueryPlan.append(executedPlan, append, verbose, addSuffix, maxFields)
|
||||||
} catch {
|
} catch {
|
||||||
case _: AnalysisException =>
|
case e: AnalysisException => append(e.toString)
|
||||||
}
|
}
|
||||||
QueryPlan.append(analyzed, append, verbose, addSuffix, maxFields)
|
|
||||||
append("\n== Optimized Logical Plan ==\n")
|
|
||||||
QueryPlan.append(optimizedPlan, append, verbose, addSuffix, maxFields)
|
|
||||||
append("\n== Physical Plan ==\n")
|
|
||||||
QueryPlan.append(executedPlan, append, verbose, addSuffix, maxFields)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override def toString: String = withRedaction {
|
override def toString: String = withRedaction {
|
||||||
|
|
Loading…
Reference in a new issue