Skip to content

Commit

Permalink
[SPARK-2013] Documentation for saveAsPickleFile and pickleFile in Python
Browse files Browse the repository at this point in the history
  • Loading branch information
kanzhang committed Jun 14, 2014
1 parent 8919685 commit e728516
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions docs/programming-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,15 @@ Some notes on reading files with Spark:

* The `textFile` method also takes an optional second argument for controlling the number of slices of the file. By default, Spark creates one slice for each block of the file (blocks being 64MB by default in HDFS), but you can also ask for a higher number of slices by passing a larger value. Note that you cannot have fewer slices than blocks.

Apart from reading files as a collection of lines,
`SparkContext.wholeTextFiles` lets you read a directory containing multiple small text files, and returns each of them as (filename, content) pairs. This is in contrast with `textFile`, which would return one record per line in each file.
Apart from text files, Spark's Python API also supports several other data formats:

### SequenceFile and Hadoop InputFormats
* `SparkContext.wholeTextFiles` lets you read a directory containing multiple small text files, and returns each of them as (filename, content) pairs. This is in contrast with `textFile`, which would return one record per line in each file.

* `RDD.saveAsPickleFile` and `SparkContext.pickleFile` support saving and reading an RDD in a simple format consisting of pickled Python objects. Batching is used on pickle serialization, with default batch size 10.

In addition to reading text files, PySpark supports reading ```SequenceFile```
and any arbitrary ```InputFormat```.
* Details on reading `SequenceFile` and arbitrary Hadoop `InputFormat` are given below.

### SequenceFile and Hadoop InputFormats

**Note** this feature is currently marked ```Experimental``` and is intended for advanced users. It may be replaced in future with read/write support based on SparkSQL, in which case SparkSQL is the preferred approach.

Expand Down

0 comments on commit e728516

Please sign in to comment.