在火花中加入数据框

joining DataFrames in spark

我想使用 or 函数

通过两个键连接两个数据帧:edges 和 selectedComponent
 val selectedComponent = hiveContext.sql(s"""select * from $tableWithComponents
         |where component=$component""".stripMargin)

但不是这样

val theSelectedComponentEdges = hiveContext.sql(
  s"""select * from $tableWithComponents a join $edges b where (b.src=a.id or b.dst=a.id)""")

但使用连接函数

edges.join(selectedComponent, edges("src")===selectedComponent("id"))

但我不确定我应该如何在这里使用 "or"。

任何人都可以帮助我:-)?

edges.join(selectedComponent, (edges("src")===selectedComponent("id")) ||  (edges("dst")===selectedComponent("id")))