Skip to content

Commit

Permalink
Added doctest for map function in rdd.py
Browse files Browse the repository at this point in the history
Doctest added for map in rdd.py

Author: Jyotiska NK <[email protected]>

Closes apache#177 from jyotiska/pyspark_rdd_map_doctest and squashes the following commits:

a38527f [Jyotiska NK] Added doctest for map function in rdd.py
  • Loading branch information
jyotiska authored and mateiz committed Mar 19, 2014
1 parent 79d07d6 commit 67fa71c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/pyspark/rdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ def getCheckpointFile(self):
def map(self, f, preservesPartitioning=False):
"""
Return a new RDD by applying a function to each element of this RDD.
>>> rdd = sc.parallelize(["b", "a", "c"])
>>> sorted(rdd.map(lambda x: (x, 1)).collect())
[('a', 1), ('b', 1), ('c', 1)]
"""
def func(split, iterator): return imap(f, iterator)
return PipelinedRDD(self, func, preservesPartitioning)
Expand Down

0 comments on commit 67fa71c

Please sign in to comment.