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 2021/03/21 14:39:20 UTC

[GitHub] [spark] wangyum commented on a change in pull request #29726: [SPARK-32855][SQL] Improve the cost model in pruningHasBenefit for filtering side can not build broadcast by join type

wangyum commented on a change in pull request #29726:
URL: https://github.com/apache/spark/pull/29726#discussion_r598289449



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/dynamicpruning/PartitionPruning.scala
##########
@@ -147,10 +151,15 @@ object PartitionPruning extends Rule[LogicalPlan] with PredicateHelper {
       case _ => fallbackRatio
     }
 
+    val estimatePruningSideSize = filterRatio * partPlan.stats.sizeInBytes.toFloat
     // the pruning overhead is the total size in bytes of all scan relations
     val overhead = otherPlan.collectLeaves().map(_.stats.sizeInBytes).sum.toFloat
-
-    filterRatio * partPlan.stats.sizeInBytes.toFloat > overhead.toFloat
+    if (canBuildBroadcast) {
+      estimatePruningSideSize > overhead
+    } else {
+      // We need to make sure that otherPlan can be broadcast by size to avoid driver OOM
+      canBroadcastBySize(otherPlan, conf) && estimatePruningSideSize * 0.04 > overhead

Review comment:
       (pruning side stats size) * 0.04 * 0.5(spark.sql.optimizer.dynamicPartitionPruning.fallbackFilterRatio) > 10M(spark.sql.autoBroadcastJoinThreshold)
   
   The (pruning side stats size) around 500M.




-- 
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



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