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 2020/02/21 16:30:54 UTC

[GitHub] [spark] maryannxue commented on a change in pull request #27669: [SPARK-30918][SQL] improve the splitting of skewed partitions

maryannxue commented on a change in pull request #27669: [SPARK-30918][SQL] improve the splitting of skewed partitions
URL: https://github.com/apache/spark/pull/27669#discussion_r382661964
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/OptimizeSkewedJoin.scala
 ##########
 @@ -61,6 +84,19 @@ case class OptimizeSkewedJoin(conf: SQLConf) extends Rule[SparkPlan] {
     }
   }
 
+  /**
+   * The goal of skew join optimization is to make the data distribution more even. The target size
+   * to split skewed partitions is the average size of non-skewed partition, or the
+   * target post-shuffle partition size if avg size is smaller than it.
+   */
+  private def targetSize(stats: MapOutputStatistics, medianSize: Long): Long = {
+    val targetPostShuffleSize = conf.getConf(SQLConf.SHUFFLE_TARGET_POSTSHUFFLE_INPUT_SIZE)
+    val nonSkewSizes = stats.bytesByPartitionId.filterNot(isSkewed(_, medianSize))
 
 Review comment:
   We can move this repetitive calc of non-skew average size out of this method, which will leave us just two local variables before the main loop below: `targetPostShuffleSizeConf` and `nonSkewAvgSize`. Then we only need to do: `max(targetPostShuffleSizeConf, nonSkewAvgSize)` without a method call.

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


With regards,
Apache Git Services

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