Skip to content

Commit c89f725

Browse files
committed
Code review
1 parent 8016390 commit c89f725

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/ExplainUtils.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@ object ExplainUtils {
9797
getSubqueries(plan, subqueries)
9898
var i = 0
9999

100-
// Process all the subqueries in the plan.
100+
/**
101+
* 1. [[getSubqueries]] collects the child plan [[BaseSubqueryExec]]
102+
* 2. [[processPlan]] checks the collected child plan of [[BaseSubqueryExec]]. If child plan
103+
* is an instance of [[BaseSubqueryExec]] (happens in case of `ReusedSubqueryExec`), then
104+
* it skips calling [[processPlanSkippingSubqueries]] in order to avoid printing the same
105+
* subquery plan more than once.
106+
*/
101107
for (sub <- subqueries) {
102108
if (i == 0) {
103109
append("\n===== Subqueries =====\n\n")
@@ -201,7 +207,7 @@ object ExplainUtils {
201207
e.plan match {
202208
case s : BaseSubqueryExec =>
203209
subqueries += ((p, e, s.child))
204-
getSubqueries(e.plan, subqueries)
210+
getSubqueries(s, subqueries)
205211
}
206212
case other =>
207213
})

0 commit comments

Comments
 (0)