Spark:减去两个DataFrames [英] Spark: subtract two DataFrames

查看:190
本文介绍了Spark:减去两个DataFrames的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Spark版本 1.2.0 中,可以使用减号与2 SchemRDD 最终只得到与第一个不同的内容

In Spark version 1.2.0 one could use subtract with 2 SchemRDDs to end up with only the different content from the first one

val onlyNewData = todaySchemaRDD.subtract(yesterdaySchemaRDD)

onlyNewData 包含 todaySchemRDD yesterdaySchemaRDD 中不存在。

如何通过 DataFrames 在Spark版本 1.3.0

How can this be achieved with DataFrames in Spark version 1.3.0?

推荐答案

根据 api docs ,做:

dataFrame1.except(dataFrame2)

将返回一个包含dataFrame1中的行的新DataFrame,但不会在dataframe2中。

will return a new DataFrame containing rows in dataFrame1 but not in dataframe2.

这篇关于Spark:减去两个DataFrames的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆