cloud-fan commented on a change in pull request #32689:
URL: https://github.com/apache/spark/pull/32689#discussion_r641315925



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/QueryStageExec.scala
##########
@@ -95,18 +95,23 @@ abstract class QueryStageExec extends LeafExecNode {
   /**
    * Compute the statistics of the query stage if executed, otherwise None.
    */
-  def computeStats(): Option[Statistics] = resultOption.get().map { _ =>
-    val runtimeStats = getRuntimeStatistics
-    val dataSize = runtimeStats.sizeInBytes.max(0)
-    val numOutputRows = runtimeStats.rowCount.map(_.max(0))
-    Statistics(dataSize, numOutputRows, isRuntime = true)
+  def computeStats(): Option[Statistics] = {

Review comment:
       nit:
   ```
   def computeStats(): Option[Statistics] = if (isMaterialized) {
      ...
   } else {
     ...
   }
   ```




-- 
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:
us...@infra.apache.org



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

Reply via email to