subtract
Return an RDD with the elements from `this` that are 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: Partitioner): RDD[T]
val a = sc.parallelize( to )
val b = sc.parallelize( to )
val c = a.subtract(b)
c.collect
Array[Int] = Array(, )
 
intersection
Return the intersection of this RDD and another one.  The output will not contain any duplicate elements, even if the input RDDs did.   交集
def intersection(other: RDD[T], numPartitions: Int): RDD[T]
def intersection(other: RDD[T], partitioner: Partitioner)(implicit ord: Ordering[T] = null): RDD[T]
def intersection(other: RDD[T]): RDD[T]
val x = sc.parallelize( to )
val y = sc.parallelize( to )
val z = x.intersection(y)
z.collect
Array[Int] = Array(, , , , , , )
cartesian
Return the Cartesian product of this RDD and another one, that is, the RDD of all pairs of elements (a, b) where a is in `this` and b is in `other` .   笛卡尔积
def cartesian[U: ClassTag](other: RDD[U]): RDD[(T, U)] 
val x = sc.parallelize(List(,,))
val y = sc.parallelize(List(,,))
x.cartesian(y).collect
Array[(Int, Int)] = Array((,), (,), (,), (,), (,), (,), (,), (,), (,))

RDD常用方法之subtract&intersection&cartesian的更多相关文章

  1. 小白学习Spark系列三:RDD常用方法总结

    上一节简单介绍了Spark的基本原理以及如何调用spark进行打包一个独立应用,那么这节我们来学习下在spark中如何编程,同样先抛出以下几个问题. Spark支持的数据集,如何理解? Spark编程 ...

  2. spark-shell 中rdd常用方法

    centos 7.2     spark 2.3.3      scala 2.11.11    java 1.8.0_202-ea spark-shell中为scala语法格式 1.distinct ...

  3. [Pyspark]RDD常用方法总结

    aggregate(zeroValue, seqOp, combOp) 入参: zeroValue表示一组初值 Tuple seqOp表示在各个分区partition中进行 什么样的聚合操作,支持不同 ...

  4. Spark笔记:RDD基本操作(上)

    本文主要是讲解spark里RDD的基础操作.RDD是spark特有的数据模型,谈到RDD就会提到什么弹性分布式数据集,什么有向无环图,本文暂时不去展开这些高深概念,在阅读本文时候,大家可以就把RDD当 ...

  5. 【原】Learning Spark (Python版) 学习笔记(一)----RDD 基本概念与命令

    <Learning Spark>这本书算是Spark入门的必读书了,中文版是<Spark快速大数据分析>,不过豆瓣书评很有意思的是,英文原版评分7.4,评论都说入门而已深入不足 ...

  6. RDD弹性分布式数据集的基本操作

    RDD的中文解释是弹性分布式数据集.构造的数据集的时候用的是List(链表)或者Array数组类型/* 使用makeRDD创建RDD */ /* List */ val rdd01 = sc.make ...

  7. spark中RDD的转化操作和行动操作

    本文主要是讲解spark里RDD的基础操作.RDD是spark特有的数据模型,谈到RDD就会提到什么弹性分布式数据集,什么有向无环图,本文暂时不去展开这些高深概念,在阅读本文时候,大家可以就把RDD当 ...

  8. Spark学习笔记2:RDD编程

    通过一个简单的单词计数的例子来开始介绍RDD编程. import org.apache.spark.{SparkConf, SparkContext} object word { def main(a ...

  9. 【spark】RDD操作

    RDD操作分为转换操作和行动操作. 对于RDD而言,每一次的转化操作都会产生不同的RDD,供一个操作使用. 我们每次转换得到的RDD是惰性求值的 也就是说,整个转换过程并不是会真正的去计算,而是只记录 ...

随机推荐

  1. HDU 1285 确定比赛排名 (数组实现 )

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1285 确定比赛名次 Time Limit: 2000/1000 MS (Java/Others)    ...

  2. Android下载更新代码

    其实是昨天反编译一个apk,给它添加一个自动更新的功能用到的.为了在smali下方便查看,代码写的不规范,反正到了smali都一个吊样~~~~ 权限: <uses-permission andr ...

  3. Flex 监听浏览器关闭

    在creationComplete的事件中,添加如下: if(ExternalInterface.available)//外部接口是否可用    {     var js:String= " ...

  4. Angularjs 服务注册

    $injector: (When you request a service, the $injector is responsible for finding the correct service ...

  5. Android Volley gives me 400 error

    本文来自:http://stackoverflow.com/questions/21739276/android-volley-gives-me-400-error 本人是根据文中的其中一方法: I ...

  6. google搜索技巧

    说明:‘’是为了突出,不属于搜索表达式的一部分 —————————————————————— 1.空格 空格代表和 例如 复旦 社会学 搜索结果网页同时包含这两个关键字. 2.‘-’ ’-‘代表排除某 ...

  7. 【Django】Django web项目部署(Nginx+uwsgi)

    一.安装uwsgi 通过pip安装uwsgi. pip install uwsgi 测试uwsgi,创建test.py文件: def application(env, start_response): ...

  8. About Flash

    Take SAMSUNG K9F1G08U0E for example, and use S3C2416, Windows CE5.0 platform. 要让Flash工作起来,包括两部分: Fla ...

  9. [Thinking in Java]这些必须先了解

    2.基本概念和认识 2.1 Java引用 Java中一切皆是对象,一切对象实例的标识符号(对象名称)都只是对象的引用. 2.2 对象的创建 通过new关键字创建,但是要注意基础类型和String类型的 ...

  10. Matlab 进阶学习记录

    最近在看 Faster RCNN的Matlab code,发现很多matlab技巧,在此记录: 1. conf_proposal  =  proposal_config('image_means', ...