intersect except是spark提供的集合差集运算, 但是要求参与运算的两个dataframe,有相同的data Schema。

如果我想从 集合1(attribute1, attribute2, attribute3)求 attribute2 出现在另一个集合2(attribute2, attribute4, attribute5)里的所有行

则intersect 完全无效, 我刚接触spark没多久, 只好就绕了一下路。 实践如下。

multiple_orders$forJoin = multiple_orders$presentee_mobile
multiple_orders$presentee_mobile=NULL
order_nonFastCar <- join(order_nonFastCar, multiple_orders, order_nonFastCar$presentee_mobile==multiple_orders$forJoin, "left_outer")
order_nonFastCar= filter(order_nonFastCar, "forJoin is null")
order_nonFastCar$forJoin=NULL

把属性改一下名, 是因为order_nonFastCar里也有presentee_mobile这个属性列。 如果不改名, join之后无法通过filter求交集

spark 集合交集差集运算的更多相关文章

  1. 【转载】C#使用Except方法求取两个List集合的差集数据

    在C#语言的编程开发中,针对List集合的运算有时候需要计算两个List集合的差集数据,集合的差集是取在该集合中而不在另一集合中的所有的项.A集合针对B集合的差集数据指的是所有在A集合但不在B集合的元 ...

  2. sql server 交集,差集的用法 (集合运算)

    概述 为什么使用集合运算: 在集合运算中比联接查询和EXISTS/NOT EXISTS更方便. 并集运算(UNION) 并集:两个集合的并集是一个包含集合A和B中所有元素的集合. 在T-SQL中.UN ...

  3. List之Union(),Intersect(),Except() 即并集,交集,差集运算。

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  4. 关于C++里set_intersection(取集合交集)、set_union(取集合并集)、set_difference(取集合差集)等函数的使用总结

    文章转载自https://blog.csdn.net/zangker/article/details/22984803 set里面有set_intersection(取集合交集).set_union( ...

  5. C++求集合的交集差集

    标准库的<algorithm>头文件中提供了std::set_difference,std::set_intersection和std::set_union用来求两个集合的差集,交集和并集 ...

  6. C# List 集合 交集、并集、差集、去重, 对象集合、 对象、引用类型、交并差补、List<T>

    关键词:C#  List 集合 交集.并集.差集.去重, 对象集合. 对象.引用类型.交并差.List<T> 有时候看官网文档是最高效的学习方式! 一.简单集合 Intersect 交集, ...

  7. C# 集合的交集 差集 并集 去重

    C# 集合的交集 差集 并集 去重 两个对象list,直接比较是不行的,因为他们存的地址不一样 需要重写GetHashCode()与Equals(object obj)方法告诉电脑 class Stu ...

  8. .NET的求复杂类型集合的差集、交集、并集

    前言 如标题所述,在ASP.NET应用程序开发中,两个集合做比较时 我们使用微软IEnumerable封装的 Except/Intersect/Union 取 差集/交集/并集 方法是非常的方便的: ...

  9. spark之交集并集差集拉链

    spark之交集并集差集拉链 def main(args: Array[String]): Unit = { val sparkConf = new SparkConf().setMaster(&qu ...

随机推荐

  1. 学习Webservice之入天气小试

    主要方法是:通过程序中设置代理用公司内网访问外部Webservice public InputStream getSoapInputStream(String url) { InputStream i ...

  2. git remove cache

    若在提交.gitignore之前,不小心提交了无用的文件入repo,可以用以下命令在repo中去除这些文件 git rm -r --cached <filename or .> git a ...

  3. Redis多机功能之复制

    复制的目的:创建具有相同数据库的拷贝服务器:扩展系统处理读请求的能力: 复制的定义 Redis的复制(replication)功能允许用户根据一个Redis服务器来创建任意多个该服务器的复制品,其中被 ...

  4. JDK源码分析之集合02ArrayList

    一.前言 有了前一篇对集合类的概述,我们知道ArrayList是属于Collection类系中的一个具体实现类,其特点是长度可以动态改变,集合内部使用数组保存元素.下面我们对源码进行分析. 二.Arr ...

  5. 【LeetCode】16. 3Sum Closest

    题目: Given an array S of n integers, find three integers in S such that the sum is closest to a given ...

  6. Linux自动化安装cobbler

    1介绍 1.1 PXE PXE技术与RPL技术不同之处为RPL是静态路由,PXE是动态路由.RPL是根据网卡上的ID号加上其他记录组成的一个Frame(帧)向服务器发出请求.而服务器中已有这个ID数据 ...

  7. UITableView 详解 ()

    (原本取至D了个L微信公众号) UITableView 详解 一.建立 UITableView DataTable = [[UITableView alloc] initWithFrame:CGRec ...

  8. SQL数据库基本语句

    SQL特点--> 1)综合统一.SQL是集数据定义.数据操作和数据控制于一体,语言峰峰统一,可独立完成数据库生命周期的所有活动. 2)高度非过程化.SQL语言是高度非过程化语言,当进行数据操作时 ...

  9. asp.net ashx 一般处理程序 使用async await异步直接 copy可用哦

    以前一直很懒  碰到ashx要用await异步就绕开  用aspx  或者mvc异步控制器  这次公司需要  我查了国内的文章基本都不能简单copy来处理一堆错关键的过程中函数BeginProcess ...

  10. Recover damage pictures to see the crime scene

    Few people know that when you take photos there is also a thumbnail embeded inside the file, even so ...