cloud-fan commented on code in PR #57443:
URL: https://github.com/apache/spark/pull/57443#discussion_r3690712133


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/columnar/InMemoryRelation.scala:
##########
@@ -500,6 +654,13 @@ case class InMemoryRelation(
 
   def cachedPlan: SparkPlan = cacheBuilder.cachedPlan
 
+  override def statsAvailable: Boolean =
+    cacheBuilder.storageLevel.useDisk && 
cacheBuilder.repeatableMaterializedStats.isDefined

Review Comment:
   Could we expose one materialized-metadata snapshot and reuse it for all 
eligibility checks? `statsAvailable` and `isOutputRepeatable` each fold every 
partition's statistics, and `leaf.stats.rowCount` may fold them again, so one 
optimizer check can scan the partition map three times.



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

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