sqlContext = HiveContext(sc)
tableData = sqlContext.sql("SELECT * FROM TABLE")
# tableData is a dataframe containing reference to schema of table, check this using tableData.printSchema()
tableData.collect() #collect executes query and provide all rows from sql
1条答案
按热度按时间yvt65v4c1#
是的,为此,您需要将hivecontext与sparkcontext一起使用。这里是example:-
或者你可以参考这里https://spark.apache.org/docs/1.6.0/sql-programming-guide.html