sqlContext.sql("select * from spark.person limit 2")
复制代码
或使用org.apache.spark.sql.hive.HiveContext
import org.apache.spark.sql.hive.HiveContext
val hiveContext = new HiveContext(sc)
hiveContext.sql("select * from spark.person").show()
或者.write.mode("append").jdbc()