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 2023/01/05 06:42:32 UTC
[GitHub] [spark] ulysses-you commented on a diff in pull request #39377: [SPARK-41867][SQL] Selective predicate should respect InMemoryRelation
ulysses-you commented on code in PR #39377:
URL: https://github.com/apache/spark/pull/39377#discussion_r1062151959
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/dynamicpruning/PartitionPruning.scala:
##########
@@ -167,44 +167,10 @@ object PartitionPruning extends Rule[LogicalPlan] with PredicateHelper with Join
}
val estimatePruningSideSize = filterRatio * partPlan.stats.sizeInBytes.toFloat
- val overhead = calculatePlanOverhead(otherPlan)
+ val overhead = collectLeafPlanOverhead(otherPlan).sum.toFloat
estimatePruningSideSize > overhead
}
- /**
- * Calculates a heuristic overhead of a logical plan. Normally it returns the total
- * size in bytes of all scan relations. We don't count in-memory relation which uses
- * only memory.
- */
- private def calculatePlanOverhead(plan: LogicalPlan): Float = {
- val (cached, notCached) = plan.collectLeaves().partition(p => p match {
- case _: InMemoryRelation => true
- case _ => false
- })
- val scanOverhead = notCached.map(_.stats.sizeInBytes).sum.toFloat
- val cachedOverhead = cached.map {
- case m: InMemoryRelation if m.cacheBuilder.storageLevel.useDisk &&
Review Comment:
the cached relation should be materialized right ? otherwise its statistics should be same with normal plan.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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