spark-sql 关联查询
作者:
达微 | 来源:发表于
2019-10-11 13:09 被阅读0次
给表起别名的方式读取关联查询结果
val url = "jdbc:postgresql://192.168.1.1:5432/test"
val prop = new Properties()
prop.setProperty("user", "test")
prop.setProperty("password", "test")
prop.setProperty("driver", "org.postgresql.Driver")
val sql ="(select * from p_run run Left Join wq_vehicle vehicle on run.vid=vehicle.vid Left Join wq_tbobd obd on run.vid = obd.vid and run.utc=obd.utc where run.utc >= '2018-11-16 00:00:00' and run.utc < '2018-11-17 00:00:00' ) a ";
val dfData: DataFrame = sqlContext.read.jdbc(url,sql,prop)
本文标题:spark-sql 关联查询
本文链接:https://www.haomeiwen.com/subject/fwutmctx.html
网友评论