dongjoon-hyun 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_r384162163
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/OptimizeSkewedJoin.scala
 ##########
 @@ -34,6 +34,30 @@ import 
org.apache.spark.sql.execution.exchange.{EnsureRequirements, ShuffleExcha
 import org.apache.spark.sql.execution.joins.SortMergeJoinExec
 import org.apache.spark.sql.internal.SQLConf
 
+/**
+ * A rule to optimize skewed joins to avoid straggler tasks whose share of 
data are significantly
+ * larger than those of the rest of the tasks.
+ *
+ * The general idea is to divide each skew partition into smaller partitions 
and replicate its
+ * matching partition on the other side of the join so that they can run in 
parallel tasks.
+ * Note that when matching partitions from the left side and the right side 
both have skew,
+ * it will become a cartesian product of splits from left and right joining 
together.
+ *
+ * For example, assume the Sort-Merge join has 4 partitions:
+ * left:  [L1, L2, L3, L4]
+ * right: [R1, R2, R3, R4]
+ *
+ * Let's say L2, L4 and R3, R4 are skewed, and each of them get split into 2 
sub-partitions. This
+ * is scheduled to run 4 tasks at the beginning: (L1, R1), (L2, R2), (L2, R2), 
(L2, R2).
 
 Review comment:
   This seems to be a mistake. Did you want to say the following?
   ```
   - (L1, R1), (L2, R2), (L2, R2), (L2, R2).
   + (L1, R1), (L2, R2), (L3, R3), (L4, R4).
   ```

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