用来找到两个rdd的交集,注意,最终的new rdd的分区数量取决于两个rdd中的最大分区数量。

测试一下:

val data1 = sc.parallelize(1 to 20,1)
val data2 = sc.parallelize(1 to 5,2)
val data3 = data1.intersection(data2)
data3.partitions.length
data3.collect

输出结果是1,2,3,4,5

data3的分区数量是2

intersection的更多相关文章

  1. [LeetCode] Intersection of Two Arrays II 两个数组相交之二

    Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1] ...

  2. [LeetCode] Intersection of Two Arrays 两个数组相交

    Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1] ...

  3. [LeetCode] Intersection of Two Linked Lists 求两个链表的交点

    Write a program to find the node at which the intersection of two singly linked lists begins. For ex ...

  4. 【leetcode】Intersection of Two Linked Lists

    题目简述: Write a program to find the node at which the intersection of two singly linked lists begins. ...

  5. [LintCode] Intersection of Two Linked Lists 求两个链表的交点

    Write a program to find the node at which the intersection of two singly linked lists begins. Notice ...

  6. LeetCode Intersection of Two Arrays

    原题链接在这里:https://leetcode.com/problems/intersection-of-two-arrays/ 题目: Given two arrays, write a func ...

  7. Intersection of Two Linked Lists

    Write a program to find the node at which the intersection of two singly linked lists begins. For ex ...

  8. LeetCode Intersection of Two Arrays II

    原题链接在这里:https://leetcode.com/problems/intersection-of-two-arrays-ii/ 题目: Given two arrays, write a f ...

  9. LeetCode 350. Intersection of Two Arrays II

    Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1] ...

  10. LeetCode 349. Intersection of Two Arrays

    Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1] ...

随机推荐

  1. JS判断一个数组中是否有重复值的三种方法

    方法一: var s = ary.join(",")+","; for(var i=0;i<ary.length;i++) { if(s.replace( ...

  2. Java主流日志工具库

    在项目开发中,为了跟踪代码的运行情况,常常要使用日志来记录信息.在Java世界,有很多的日志工具库来实现日志功能,避免了我们重复造轮子.我们先来逐一了解一下主流日志工具. 1.java.util.lo ...

  3. C# 跨线程访问或者设置UI线程控件的方法

    一.背景 在C#中,由于使用线程和调用UI的线程属于两个不同的线程,如果在线程中直接设置UI元素的属性,此时就会出现跨线程错误. 二.问题解决方法 使用控件自带的Invoke或者BeginInvoke ...

  4. Radar Installation(贪心)

    Radar Installation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 56826   Accepted: 12 ...

  5. Linux LVS Nginx HAProxy 优缺点

    说明:以下内容参考了抚琴煮酒的<构建高可用Linux服务器>第六章内容. 搭建负载均衡高可用环境相对简单,主要是要理解其中原理.此文描述了三种负载均衡器的优缺点,以便在实际的生产应用中,按 ...

  6. PYTHON实现HTTP基本认证(BASIC AUTHENTICATION)

    参考: http://www.voidspace.org.uk/python/articles/authentication.shtml#id20 http://zh.wikipedia.org/wi ...

  7. C++ virtual descructor

    [代码1]  C++ Code  12345678910111213141516171819202122232425262728293031323334353637383940414243444546 ...

  8. AJAX,JSON搜索智能提示

    效果 开发结构参考AJAX,JSON用户校验 主要有两个核心文件 1,处理输入字符,进行后台搜索的servlet Suggest.java package org.guangsoft.servlet; ...

  9. July 15th, Week 29th Friday, 2016

    A book is a gift that you can open again and again. 书是你可以一次又一次打开的礼物. Some gifts are born with you, a ...

  10. 基因变异(codevs 3194)

    题目描述 Description 小毛终于来到了冥王星,这是一颗已经不属于行星的矮行星,它的表面温度低于-220度.在这里,小毛惊奇的发现,他带来的厌氧菌开始了基因变异,裂变的速度与光照时间(秒)成乘 ...