加入PySpark时有right_anti吗?

Ano*_*ous 3 parameters join function apache-spark-sql pyspark

查看文档:https://spark.apache.org/docs/latest/api/python/pyspark.sql.html? highlight=join

“how=”参数有以下选项...:

内部、交叉、外部、全、fullouter、full_outer、左、leftouter、left_outer、右、rightouter、right_outer、半、leftsemi、left_semi、anti、leftanti 和 left_anti。

连接图

我知道你可以翻转 df1 和 df2 并且仍然执行 left_anti 来实现 right_anti,但是函数参数是否完全缺少 right_anti 或者我错过/不理解一个概念?

mpS*_*der 7

我想你并没有错过这个概念。我认为它应该可用,但right_anti目前 Pyspark 中不存在。因此,我建议使用您已经提出的方法:

# Right anti join via 'left_anti' and switching the right and left dataframe. 
df = df_right.join(df_left, on=[...], how='left_anti')
Run Code Online (Sandbox Code Playgroud)