Skip to content

Commit 7187ebd

Browse files
committed
fix review findings
1 parent 5b4b719 commit 7187ebd

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/util/ReuseMap.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ReuseMap[T <: T2, T2 <: QueryPlan[T2]] {
4242
* @param plan the input plan
4343
* @return the matching plan or the input plan
4444
*/
45-
def lookupOrElseAdd(plan: T): T = {
45+
private def lookupOrElseAdd(plan: T): T = {
4646
val sameSchema = map.getOrElseUpdate(plan.schema, ArrayBuffer())
4747
val samePlan = sameSchema.find(plan.sameResult)
4848
if (samePlan.isDefined) {

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ object ExplainUtils extends AdaptiveSparkPlanHelper {
3838
*
3939
* @param plan Input query plan to process
4040
* @param append function used to append the explain output
41-
*
42-
* @return The last generated operation id for this input plan. This is to ensure we
43-
* always assign incrementing unique id to each operator.
44-
*
4541
*/
4642
private def processPlanSkippingSubqueries[T <: QueryPlan[T]](
4743
plan: T,

sql/core/src/main/scala/org/apache/spark/sql/execution/reuse/ReuseExchangeAndSubquery.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ import org.apache.spark.sql.util.ReuseMap
2626
/**
2727
* Find out duplicated exchanges and subqueries in the whole spark plan including subqueries, then
2828
* use the same exchange or subquery for all the references.
29+
*
30+
* Note that the Spark plan is a mutually recursive data structure:
31+
* SparkPlan -> Expr -> Subquery -> SparkPlan -> Expr -> Subquery -> ...
32+
* Therefore, in this rule, we recursively rewrite the exchanges and subqueries in a bottom-up way,
33+
* in one go.
2934
*/
3035
case object ReuseExchangeAndSubquery extends Rule[SparkPlan] {
3136

0 commit comments

Comments
 (0)