File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
catalyst/src/main/scala/org/apache/spark/sql/util
core/src/main/scala/org/apache/spark/sql/execution/reuse Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class ReuseMap[T <: QueryPlan[_]] {
42
42
* @param plan the input plan
43
43
* @return the matching plan or the input plan
44
44
*/
45
- def lookup (plan : T ): T = {
45
+ def lookupOrElseAdd (plan : T ): T = {
46
46
val (firstSameSchemaPlan, sameResultPlans) = map.getOrElseUpdate(plan.schema, plan -> Map ())
47
47
if (firstSameSchemaPlan ne plan) {
48
48
if (sameResultPlans.isEmpty) {
@@ -62,8 +62,8 @@ class ReuseMap[T <: QueryPlan[_]] {
62
62
* @param f the function to apply
63
63
* @return the matching plan with `f` applied or the input plan
64
64
*/
65
- def addOrElse [T2 >: T ](plan : T , f : T => T2 ): T2 = {
66
- val found = lookup (plan)
65
+ def reuseOrElseAdd [T2 >: T ](plan : T , f : T => T2 ): T2 = {
66
+ val found = lookupOrElseAdd (plan)
67
67
if (found eq plan) {
68
68
plan
69
69
} else {
Original file line number Diff line number Diff line change @@ -36,14 +36,14 @@ case class ReuseExchangeAndSubquery(conf: SQLConf) extends Rule[SparkPlan] {
36
36
37
37
def reuse (plan : SparkPlan ): SparkPlan = plan.transformUp {
38
38
case exchange : Exchange if conf.exchangeReuseEnabled =>
39
- exchanges.addOrElse (exchange, ReusedExchangeExec (exchange.output, _))
39
+ exchanges.reuseOrElseAdd (exchange, ReusedExchangeExec (exchange.output, _))
40
40
41
41
case other => other.transformExpressionsUp {
42
42
case sub : ExecSubqueryExpression =>
43
43
val subquery = reuse(sub.plan).asInstanceOf [BaseSubqueryExec ]
44
44
sub.withNewPlan(
45
45
if (conf.subqueryReuseEnabled) {
46
- subqueries.addOrElse (subquery, ReusedSubqueryExec (_))
46
+ subqueries.reuseOrElseAdd (subquery, ReusedSubqueryExec (_))
47
47
} else {
48
48
subquery
49
49
}
You can’t perform that action at this time.
0 commit comments