Spark SQL-使用SQL语句而不是表名使用JDBC加载数据

我想我缺少了一些东西,但无法弄清楚。我想使用特定的sql语句使用SQLContext和JDBC加载数据,例如


select top 1000 text from table1 with (nolock)

where threadid in (

  select distinct id from table2 with (nolock)

  where flag=2 and date >= '1/1/2015' and  userid in (1, 2, 3)

)

我应该使用哪种SQLContext方法?我看到的示例始终指定表名以及上下边界。


幕布斯6054654
浏览 764回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP