You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/03/26 14:32:39 UTC

[GitHub] [spark] mgaido91 commented on a change in pull request #24214: [SPARK-27279][SQL] Reuse subquery should compare child plan of `SubqueryExec`

mgaido91 commented on a change in pull request #24214: [SPARK-27279][SQL] Reuse subquery should compare child plan of `SubqueryExec`
URL: https://github.com/apache/spark/pull/24214#discussion_r269133230
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/subquery.scala
 ##########
 @@ -125,15 +125,15 @@ case class PlanSubqueries(sparkSession: SparkSession) extends Rule[SparkPlan] {
 case class ReuseSubquery(conf: SQLConf) extends Rule[SparkPlan] {
 
   def apply(plan: SparkPlan): SparkPlan = {
-    if (!conf.exchangeReuseEnabled) {
+    if (!conf.subqueryReuseEnabled) {
       return plan
     }
     // Build a hash map using schema of subqueries to avoid O(N*N) sameResult calls.
     val subqueries = mutable.HashMap[StructType, ArrayBuffer[SubqueryExec]]()
     plan transformAllExpressions {
       case sub: ExecSubqueryExpression =>
         val sameSchema = subqueries.getOrElseUpdate(sub.plan.schema, ArrayBuffer[SubqueryExec]())
-        val sameResult = sameSchema.find(_.sameResult(sub.plan))
+        val sameResult = sameSchema.find(_.child.sameResult(sub.plan.child))
 
 Review comment:
   I am not sure either about this fix. I remember this problem which I tried to fix in https://github.com/apache/spark/pull/22518/commits/36fa664c6d251901270984115ff2ebfd1b665fca. As you can see, the PR didn't actually do this fix as per @cloud-fan 's comment. So I am pinging him here for reviewing this too. Anyway, when I debugged it, the problem was that being the same object according to equals, the tree was not updated, so I see no reason for the current fix.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org