且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

根据另一个指定拒绝名单条件的 DataFrame 过滤 Spark DataFrame

更新时间:2023-11-28 18:51:10

在这种情况下,您需要使用 left_anti 连接.

You'll need to use a left_anti join in this case.

左反连接左半连接相反.

它根据给定的键从左表中过滤出右表中的数据:

It filters out data from the right table in the left table according to a given key :

largeDataFrame
   .join(smallDataFrame, Seq("some_identifier"),"left_anti")
   .show
// +---------------+----------+
// |some_identifier|first_name|
// +---------------+----------+
// |            222|      mary|
// |            111|       bob|
// +---------------+----------+