[Spark] [Python] What is the collect effect of the RDD?

Source: Internet
Author: User

[Continuation of the Spark][python]sortbykey example

What is the Collect () effect of the RDD?

The continuation of the [Spark][python]sortbykey example]

In []: Mydata004.collect ()

OUT[20]:
[[u ' 00001 ', U ' sku933 '],
[u ' 00001 ', U ' sku022 '],
[u ' 00001 ', U ' sku912 '],
[u ' 00001 ', U ' sku331 '],
[u ' 00002 ', U ' sku010 '],
[u ' 00003 ', U ' sku888 '],
[u ' 00004 ', U ' sku411 ']

In []: Mydata004.count ()
OUT[22]: 7

In [All]: Mydata005.count ()
---------------------------------------------------------------------------
TypeError Traceback (most recent)
<ipython-input-23-c1554a7ccdd7> in <module> ()
----> 1 Mydata005.count ()

Typeerror:count () takes exactly one argument (0 given)

In []: type (mydata005)
OUT[24]: List

in [+]: type (mydata004)
OUT[25]: Pyspark.rdd.PipelinedRDD


By comparison, mydata005 is a list.
This means that collect will return a list.

If you run <rdd>.collect in an interactive environment, the contents of all elements of this RDD are displayed.

[Spark] [Python] What is the collect effect of the RDD?

Related Article

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.