@@ -480,7 +480,7 @@ class PairRDDFunctions[K, V](self: RDD[(K, V)])
480
480
*/
481
481
def join [W ](other : RDD [(K , W )], partitioner : Partitioner ): RDD [(K , (V , W ))] = {
482
482
this .cogroup(other, partitioner).flatMapValues( pair =>
483
- for (v <- pair._1; w <- pair._2) yield (v, w)
483
+ for (v <- pair._1.iterator ; w <- pair._2.iterator ) yield (v, w)
484
484
)
485
485
}
486
486
@@ -493,9 +493,9 @@ class PairRDDFunctions[K, V](self: RDD[(K, V)])
493
493
def leftOuterJoin [W ](other : RDD [(K , W )], partitioner : Partitioner ): RDD [(K , (V , Option [W ]))] = {
494
494
this .cogroup(other, partitioner).flatMapValues { pair =>
495
495
if (pair._2.isEmpty) {
496
- pair._1.map(v => (v, None ))
496
+ pair._1.iterator. map(v => (v, None ) : ( V , Option [ W ] ))
497
497
} else {
498
- for (v <- pair._1; w <- pair._2) yield (v, Some (w))
498
+ for (v <- pair._1.iterator ; w <- pair._2.iterator ) yield (v, Some (w))
499
499
}
500
500
}
501
501
}
@@ -510,9 +510,9 @@ class PairRDDFunctions[K, V](self: RDD[(K, V)])
510
510
: RDD [(K , (Option [V ], W ))] = {
511
511
this .cogroup(other, partitioner).flatMapValues { pair =>
512
512
if (pair._1.isEmpty) {
513
- pair._2.map(w => (None , w))
513
+ pair._2.iterator. map(w => (None , w) : ( Option [ V ], W ))
514
514
} else {
515
- for (v <- pair._1; w <- pair._2) yield (Some (v), w)
515
+ for (v <- pair._1.iterator ; w <- pair._2.iterator ) yield (Some (v), w)
516
516
}
517
517
}
518
518
}
@@ -528,9 +528,9 @@ class PairRDDFunctions[K, V](self: RDD[(K, V)])
528
528
def fullOuterJoin [W ](other : RDD [(K , W )], partitioner : Partitioner )
529
529
: RDD [(K , (Option [V ], Option [W ]))] = {
530
530
this .cogroup(other, partitioner).flatMapValues {
531
- case (vs, Seq ()) => vs.map(v => (Some (v), None ))
532
- case (Seq (), ws) => ws.map(w => (None , Some (w)))
533
- case (vs, ws) => for (v <- vs; w <- ws) yield (Some (v), Some (w))
531
+ case (vs, Seq ()) => vs.iterator. map(v => (Some (v), None ) : ( Option [ V ], Option [ W ] ))
532
+ case (Seq (), ws) => ws.iterator. map(w => (None , Some (w)) : ( Option [ V ], Option [ W ] ))
533
+ case (vs, ws) => for (v <- vs.iterator ; w <- ws.iterator ) yield (Some (v), Some (w))
534
534
}
535
535
}
536
536
0 commit comments