Spark programming--actions II

Source: Internet
Author: User

Saveastextfile

Saveastextfile (path, compressioncodecclass=none)

Aveastextfile is used to store the RDD in a text file format into a file system, storing each element in string format (combined with Python's loads and dumps to be well-applied)

Parameters:

    • path –path to text file
    • Compressioncodecclass – (None by default) string i.e. "Org.apache.hadoop.io.compress.GzipCodec" specifies the compressed class name

Example:

Saveassequencefile

Sequencefile (path, keyclass=none, valueclass=none, keyconverter=none, valueconverter=none, minsplits=none, batchsize=0)

Parameters:

    • path –path to Sequncefile
    • keyclass –fully qualified classname of key writable class (e.g. "Org.apache.hadoop.io.Text")
    • valueclass –fully qualified classname of value writable class (e.g. "org.apache.hadoop.io.LongWritable")
    • Keyconverter
    • Valueconverter
    • minsplits –minimum splits in DataSet (Default min (2, sc.defaultparallelism))
    • batchsize , haven number of Python objects represented as a single Java object. (default 0, choose BatchSize automatically)

Saveassequencefile is used to save the RDD in Sequencefile file format to HDFs

Storage will be stored by default on HDFs, preserving the original format

Example:

Look at the files on HDFs, as well as get down after looking at the file format:

Saveashadoopfilesaveashadoopdatasetsaveasnewapihadoopfilesaveasnewapihadoopdataset

Spark programming--actions II

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.