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

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

问题描述

在 Spark 版本 1.2.0 中,可以使用 subtract 和 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 包含 todaySchemRDDyesterdaySchemaRDD 中不存在的行.

onlyNewData contains the rows in todaySchemRDD that do not exist in yesterdaySchemaRDD.

如何使用 Spark 版本 1.3.0 中的 DataFrames 实现这一点?

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

推荐答案

根据 Scala API 文档,正在做:

According to the Scala API docs, doing:

dataFrame1.except(dataFrame2)

将返回一个新的 DataFrame,其中包含 dataFrame1 中的行,但不包含 dataframe2 中的行.

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

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

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