【发布时间】:2016-10-18 22:17:54
【问题描述】:
我想使用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"))
但我不确定我应该如何在这里使用“或”。
任何人都可以帮助我:-)?
【问题讨论】:
标签: scala apache-spark spark-dataframe