cloud-fan commented on a change in pull request #28109: 
[SPARK-31253][SQL][followup]  Add metric to the split task number for skew 
optimization
URL: https://github.com/apache/spark/pull/28109#discussion_r402900400
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/CustomShuffleReaderExec.scala
 ##########
 @@ -116,12 +117,24 @@ case class CustomShuffleReaderExec private(
   }
 
   private def skewedPartitionMetrics = {
-    val metrics = SQLMetrics.createMetric(sparkContext, "number of skewed 
partitions")
-    val numSkewedPartitions = partitionSpecs.collect {
-      case p: PartialReducerPartitionSpec => p.reducerIndex
-    }.distinct.length
-    metrics.set(numSkewedPartitions)
-    Map("numSkewedPartitions" -> metrics)
+    val skewedPartitions = SQLMetrics.createMetric(sparkContext, "number of 
skewed partitions")
+    val splitTasks = SQLMetrics.createMetric(sparkContext, "number of split 
tasks")
+
+    val skewedMetrics = new mutable.HashMap[Int, Long]()
+    partitionSpecs.map {
 
 Review comment:
   readability is more important here. How about
   ```
       val numSkewedPartitions = partitionSpecs.collect {
         case p: PartialReducerPartitionSpec => p.reducerIndex
       }.distinct.length
   
       val numSplits = partitionSpecs.collect {
         case p: PartialReducerPartitionSpec => p
       }.length
   ```

----------------------------------------------------------------
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]


With regards,
Apache Git Services

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

Reply via email to