Skip to content

Commit

Permalink
Added doctest for textFile method in context.py
Browse files Browse the repository at this point in the history
Doctest added for method textFile in context.py
  • Loading branch information
jyotiska committed Mar 20, 2014
1 parent 5b23686 commit 356f945
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions python/pyspark/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,13 @@ def textFile(self, name, minSplits=None):
Read a text file from HDFS, a local file system (available on all
nodes), or any Hadoop-supported file system URI, and return it as an
RDD of Strings.
>>> path = os.path.join(tempdir, "sample-text.txt")
>>> with open(path, "w") as testFile:
... testFile.write("Hello world!")
>>> textFile = sc.textFile(path)
>>> textFile.collect()
[u'Hello world!']
"""
minSplits = minSplits or min(self.defaultParallelism, 2)
return RDD(self._jsc.textFile(name, minSplits), self,
Expand Down

0 comments on commit 356f945

Please sign in to comment.