Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/11865#discussion_r60138638
--- Diff: core/src/main/scala/org/apache/spark/rdd/CoalescedRDD.scala ---
@@ -337,19 +353,23 @@ private class PartitionCoalescer(maxPartitions: Int,
prev: RDD[_], balanceSlack:
* load balanced and grouped by locality
* @return array of partition groups
*/
- def run(): Array[PartitionGroup] = {
- setupGroups(math.min(prev.partitions.length, maxPartitions)) //
setup the groups (bins)
- throwBalls() // assign partitions (balls) to each group (bins)
+ def coalesce(maxPartitions: Int, prev: RDD[_]): Array[PartitionGroup] = {
+ setupGroups(math.min(prev.partitions.length, maxPartitions), prev)
// setup the groups (bins)
+ throwBalls(maxPartitions, prev, balanceSlack) // assign partitions
(balls) to each group (bins)
getPartitions
}
}
-private case class PartitionGroup(prefLoc: Option[String] = None) {
+/**
+ * A group of [[Partition]]s
+ * @param prefLoc preferred location for the partition group
+ */
+case class PartitionGroup(prefLoc: Option[String] = None) {
--- End diff --
1. move this closer to PartitionCoalescer
2. make it a normal class (case class is difficult to maintain backward
compatibility due the pattern matching)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]