Skip to content

Commit ef27759

Browse files
committed
[SPARK-54905][SQL] Simplify foreachWithSubqueries implementation in QueryPlan
1 parent 6df8d57 commit ef27759

File tree

1 file changed

+4
-3
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans

1 file changed

+4
-3
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/QueryPlan.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,11 +623,12 @@ abstract class QueryPlan[PlanType <: QueryPlan[PlanType]]
623623
* A variant of [[foreach]] which considers plan nodes inside subqueries as well.
624624
*/
625625
def foreachWithSubqueries(f: PlanType => Unit): Unit = {
626-
def actualFunc(plan: PlanType): Unit = {
626+
def traverse(plan: PlanType): Unit = {
627627
f(plan)
628-
plan.subqueries.foreach(_.foreachWithSubqueries(f))
628+
plan.subqueries.foreach(traverse)
629+
plan.children.foreach(traverse)
629630
}
630-
foreach(actualFunc)
631+
traverse(this)
631632
}
632633

633634
/**

0 commit comments

Comments
 (0)