Github user mateiz commented on a diff in the pull request:
https://github.com/apache/spark/pull/727#discussion_r12511624
--- Diff: core/src/main/scala/org/apache/spark/rdd/RDD.scala ---
@@ -328,11 +328,20 @@ abstract class RDD[T: ClassTag](
def coalesce(numPartitions: Int, shuffle: Boolean = false)(implicit ord:
Ordering[T] = null)
: RDD[T] = {
if (shuffle) {
+ /** Distributes elements evenly across output partitions, starting
from a random partition. */
+ def distributePartition(index: Int, items: Iterator[T]):
Iterator[(Int, T)] = {
+ var position = (new Random(index)).nextInt(numPartitions)
+ items.map{ t =>
--- End diff --
Put a space before `{`
---
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.
---