dongjoon-hyun commented on a change in pull request #29726:
URL: https://github.com/apache/spark/pull/29726#discussion_r602035906



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/dynamicpruning/PartitionPruning.scala
##########
@@ -146,10 +150,18 @@ 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 can't reuse the broadcast because the join type doesn't support 
broadcast,
+      // and doing DPP means running an extra query that may have significant 
overhead.
+      // We need to make sure the pruning side is very big so that DPP is 
still worthy.
+      canBroadcastBySize(otherPlan, conf) &&
+        estimatePruningSideSize * 
conf.dynamicPartitionPruningPruningSideExtraFilterRatio > overhead

Review comment:
       Could you update this function description according to this new 
configuration, please? For now, we are mentioning only 
`spark.sql.optimizer.joinFilterRatio`.




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to