cloud-fan commented on a change in pull request #30026: URL: https://github.com/apache/spark/pull/30026#discussion_r506112571
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/BasicWriteStatsTracker.scala ########## @@ -139,20 +142,22 @@ class BasicWriteJobStatsTracker( override def processStats(stats: Seq[WriteTaskStats]): Unit = { val sparkContext = SparkContext.getActive.get - var numPartitions: Long = 0L + var partitionsSet: mutable.Set[InternalRow] = mutable.HashSet.empty var numFiles: Long = 0L var totalNumBytes: Long = 0L var totalNumOutput: Long = 0L val basicStats = stats.map(_.asInstanceOf[BasicWriteTaskStats]) basicStats.foreach { summary => - numPartitions += summary.numPartitions + partitionsSet ++= summary.partitions numFiles += summary.numFiles totalNumBytes += summary.numBytes totalNumOutput += summary.numRows } + val numPartitions: Long = partitionsSet.size Review comment: nit: it's only used once, we can inline it. ---------------------------------------------------------------- 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