The Subtract&intersection&cartesian of the common methods of RDD

Source: Internet
Author: User

SubtractReturn an RDD with the elements from ' this ' is not in ' other '.
def subtract (other:rdd[t]): Rdd[t]def subtract (other:rdd[t], numpartitions:int): Rdd[t]def subtract (other:rdd[t], p:p Artitioner): Rdd[t]
Val A = sc.parallelize (15= sc.parallelize (13== Array (45)

intersectionReturn the intersection of this RDD and another one. The output won't contain any duplicate elements, even if the-input RDDs did. intersection
NULL ): Rdd[t]def intersection (Other:rdd[t]): Rdd[t]
Val x = sc.parallelize (1= sc.parallelize (28== Array (4682375)

CartesianReturn the Cartesian product of this rdd and another one, that's, the RDD of all pairs of elements (a, b) where a was in ' This ' and B are in ' other '. Cartesian product
Val x = sc.parallelize (List (1,2,3)) Val y= Sc.parallelize (List (6,7,8) ) X.cartesian (y). Collect array[(int, int)]= Array (1,6), (1,7), (1,8), (2,6), (3,6), (2,7), (2,8), (3,7), (3,8))

The Subtract&intersection&cartesian of the common methods of RDD

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.