Skip to content

Commit f8d6273

Browse files
committed
Test python groupWith for one more case
1 parent 0e9009c commit f8d6273

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

python/pyspark/rdd.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,11 +1327,13 @@ def groupWith(self, other, *others):
13271327
"""
13281328
Alias for cogroup but with support for multiple RDDs.
13291329
1330+
>>> w = sc.parallelize([("a", 5), ("b", 6)])
13301331
>>> x = sc.parallelize([("a", 1), ("b", 4)])
13311332
>>> y = sc.parallelize([("a", 2)])
13321333
>>> z = sc.parallelize([("b", 42)])
1333-
>>> map((lambda (x,y): (x, (list(y[0]), list(y[1]), list(y[2])))), sorted(list(x.groupWith(y, z).collect())))
1334-
[('a', ([1], [2], [])), ('b', ([4], [], [42]))]
1334+
>>> map((lambda (x,y): (x, (list(y[0]), list(y[1]), list(y[2]), list(y[3])))), \
1335+
sorted(list(w.groupWith(x, y, z).collect())))
1336+
[('a', ([5], [1], [2], [])), ('b', ([6], [4], [], [42]))]
13351337
13361338
"""
13371339
return python_cogroup((self, other) + others, numPartitions=None)

0 commit comments

Comments
 (0)